Reputation: 226
I am new to this site. I am facing a problem with socket programming in Java. I have written a server, which processes the clients. Everything is fine and working ordinarily.
What should I do if the network on which I want to run the server is password protected? That means we have to provide the username and the password of the system on which we want to login?
If I am running the server on this kind of protected network and trying to connect via client, the client socket is not getting created, because the server is refusing the connection.
Upvotes: 0
Views: 413
Reputation: 86774
If I am running the server on this kind of protected network and trying to connect via client, the client socket is not getting created, because the server is refusing the connection.
There are many reasons why a server could be refusing the connection. If you can connect when the client and server are running on the same machine, but not when the client is on a different machine, the problem likely is that the server is running a firewall and not allowing connections from "outside".
If the client is on a completely different network segment, i.e. the client is somewhere on the Internet "far" away, then there could be multiple firewalls between the two systems, any of which could be rejecting the connection.
Another possibility is that when the server opens its ServerSocket
, you bound it to 127.0.0.1
instead of 0.0.0.0
. In this case, the server could accept connections only from localhost
, i.e. originating on the same machine. It would be completely unaware of connection originating anywhere else.
Without a much better explanation of how the client and server are situated, it is not possible to give a better answer. One thing is certain however: the fact that you require authentication to "login" to a system has nothing to do with your situation.
Upvotes: 1