Reputation: 827
I am working on a communication medium between two computers. They are both on the same network. I know the remote ip of each device.
I am trying to write a C program that acts as a server on one machine, and a client on the other.
I am trying to make this connection using TCP protocol on port 311 from the client. I am wondering how to setup the server? Which address do I bind to on the server so it will accept remote request from a client service?
Upvotes: 0
Views: 87
Reputation: 19761
Usually you bind to the special ip address called INADDR_ANY. This allows your server to be available to incoming connections on any interface. This way you can connect to your server via localhost/loopback if you're on the same machine or via any of the external interfaces the server computer may have - regardless of the configuration.
Here's a good description
Upvotes: 1