1. Create a simple socket programming process as follows for connected socket programming Server: 1) Create socket (socket) 2) bind socket to a local address and port (BIND) 3) set socket to listen mode, prepare to accept client request (listen) 4) Wait for the client request to arrive, when the request arrives, accept the connection request, return a new socket corresponding to this connection (accept) 5) with the returned socket and the client for communication (SEND/RECV), 6) Return, wait for another client to request 7) Close the socket client: 1) Create socket (socket) 2) Make connection request to server (connect) 3) and Server for Communication (SEND/RECV) 4) Close socket
For a non-connected socket programming Server: (receiver) 1) Create socket (socket) 2) bind the socket to a local address and port (BIND) 3) communicate with the client using the returned socket (recvfrom); 4) Close the socket Word client: (sender side) 1) Create socket (socket) 2) Send data to Server (SENDTO3) Close socket
Linux C + + socket Server Client