简体   繁体   中英

Connection computers on network

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?

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM