Your Question: How Do I Run a Tcp Client Server in Linux?
Contents How Do I Run a Client and Server Program in Linux? a Simple Stream Client Program Example #Define Maxdatasize 300. Int Main(Int Argc, Char *Argv[]) {...
Contents
How do I run a client and server program in Linux?
A Simple Stream Client Program Example
- #define MAXDATASIZE 300. int main(int argc, char *argv[]) { int sockfd, numbytes; char buf[MAXDATASIZE]; …
- struct sockaddr_in their_addr; // if no command line argument supplied. if(argc != 2) { …
- } // get the host info. if((he=gethostbyname(argv[1])) == NULL) {
How do I start a TCP server?
TCP Server –
- using create(), Create TCP socket.
- using bind(), Bind the socket to server address.
- using listen(), put the server socket in a passive mode, where it waits for the client to approach the server to make a connection.
10 окт. 2019 г.