The ATEasy Winsock API provides easy access to TCP and UDP network services. To write client or server applications you do not need to understand the details of TCP or to call low-level Winsock APIs. Using ATEasy's Internal Library Winsock (Wsxxxx) functions, you can easily connect to a remote machine and exchange data in both directions.
Note: If you computer is configured with a firewall, make sure to allow ATEasy or your application Executable to access the port by creating an outbound or inbound rules for the appropriate TCP/IP remote port or application.
The Transfer Control Protocol (TCP) allows you to create and maintain a connection to a remote computer. Using the connection, both computers can stream data between themselves.
Both client and server must call the WsCreate method to create a socket (handle) for the connection.
If you are creating a server application, invoke the WsBind method, specifying the local port parameter (lLocalPort). When the client computer requests a connection, invoke the WsListen method followed by the WsAccept method to complete the connection.
If you are creating a client application, you must know the server computer's name or IP address (lRemoteHost), as well as the port (lRemotePort) on which it will be "listening." Then invoke the WsConnect function.
Once a connection has been made, either computer can send and receive data. To send data, invoke the WsSend method. To receive data, call the WsReceive function.
Both client and server must call the WsCreate method to get a socket (handle) for the connection.
The User Datagram Protocol (UDP) is a connectionless protocol. Unlike in TCP operations, computers do not establish a connection.
To transmit data, first set the server computer's LocalPort parameter. The client computer then needs only to set the lRemoteHost to the Internet address of the server computer, and the lRemotePort parameter to the same port as the server computer's lLocalPort parameter, and invoke the WsSend method to begin sending messages. The client computer then uses the WsReceive method to retrieve the sent messages.
Use TCP/IP when it is critical to receive all the data in correct order and when you require acknowledgement that data has been received. Use the UDP protocol when the data flow is one way and when it is not critical that all the data get to the destination, for example, with audio sound.