/* NAME: tcpServer0 SYNOPSIS: tcpServer0 DESCRIPTION: The program creates a tcp socket in the inet domain, binds it to port 12345, listen and accept a connection from tcpClient0, and receives any message arrived to the socket and prints it out */ #include "def" main( argc, argv ) int argc; char *argv[]; { int sd, psd; struct sockaddr_in name; char buf[1024]; int cc; sd = socket (AF_INET,SOCK_STREAM,0); name.sin_family = AF_INET; name.sin_addr.s_addr = htonl(INADDR_ANY); name.sin_port = htons(atoi(argv[1])); bind( sd, (SA *) &name, sizeof(name) ); pause(); }