1. the IP address was correct.
2. the port address was correct.
3. I created a rule to allow incoming on the selected port.
I then wrote a simple client on the remote machie and tried that. All I got was connection timed out error.
I then disabled the firewall on both machines and still it would not connect. I checked using netstat to make sure everything looked OK and my port number was right there and its entry was the same as 23 and the others. The only differences being the associated application.
1. experimented with telnet on the client machine. If I tried my port number (9991) it would not work. If I tried 1042, from the netstat list, it instantly connected. If I used 23 it wanted a username and password. Clearly the client machine could communicate with the server computer on some ports.
2. experimented with the client program. If I used 23 as the port it would connect to the server with no problem.
It seems I must be missing something when it comes to setting up the port but I have no idea what. Some things I read said that the router doesn't matter since I am doing this all within the home network. One guy, though, said that he got his sockets to work when he switched modems. But he had no idea why that would do anything.
So what do I have to do to get this to work with my port 9991? To recap:
1. telnet can connect to ports remotely - 23 and 1042, for example - but not to 9991.
2. my java client program can connect to port 23 but not to 9991.
Since the ports that work are predefined and my 9991 is done through a program. I assume it must have something to with that. Not the language because my program is simple and is the same as others from the internet and my Java book. It is not the firewall because I disabled them and things still did not work. Anyone have any ideas? Thanks in advance for any guidance anyone can give.
leigh matheson wrote:I am trying to use sockets. I created a simple server and tested it with Telnet, using both localhost and the IP address, on the same machine and it worked fine. I went to another computer, on the same home network, and tried Telnet from there but it could not connect.
Can you post the output from netstat for your port?
leigh matheson wrote:I checked using netstat to make sure everything looked OK and my port number was right there and its entry was the same as 23 and the others.
Where did that come from? Do you have another server application running on the server computer, or was your connection being intercepted by another device/platform such as a router/firewall?
leigh matheson wrote:If I used 23 it wanted a username and password.
Can you post your server code here?
leigh matheson wrote:... my program is simple and is the same as others from the internet and my Java book.
Server code of relevance ( as I said very basic, straight from the book, etc):
Netstat stuff for 23 and 9991 (all the Listening entries are the same):
As I said it works on one machine using either localhost or IP address (192.168.1.12).
This is a home network hooked up through a Verizon router. They are on the same subnet. The server is win7 and I have tried connecting to it from win10 and XP. I can ping the server with no problem.
I am assuming it was connecting to port 23 on the machine specified in the IP address (telnet 192.168.1.12 9991). Is there some reason why it wouldn't? There are no other servers running, I disabled the firewalls (I already said this and hate to repeat myself) and it made no difference. I did mention that one person I found said that replacing the router made his server/client work. And why ask if something else was intercepting things? If I knew that and couldn't figure out what to do about that I would be asking specifically about that. Can you tell me what on the router to look for? And, again, it is not the firewall since I disabled them on BOTH machines.
Edit: Added code tags to format your code
If you want to post a working example of your code, I could try running it as well and confirm that it works in my environment.
To avoid criticism do nothing, say nothing, be nothing. -Elbert Hubbard. Please critique this tiny ad:
Rocket Oven Kickstarter - from the trailbosshttps://coderanch.com/t/695773/Rocket-Oven-Kickstarter-trailboss