Server
1. Initialize WSAStartup (..)
2. Create sockets = Socket (..)
3. Bind port ret = bind (...)
4. Monitor ret = Listen (..)
5. Receive Client connection request S_new = Accept (...) Three times the handshake takes place in this process
6. Send and receive data RET = recv (..) Blocking mode, memory is not enough to store the information sent, block Send ()//non-blocking, depending on the size of buffer space to send the corresponding large data, do not block send ()
ret = Send (..)
7. Close the connection
The difference between a client and a server is that there is no need to bind Port 1. Initialize WSAStartup (..)
2. Create sockets = Socket (..)
3. Connect to the server connect (.. )
4. Send and receive data RET = recv (..) Blocking mode, memory is not enough to store the information sent, block Send ()//non-blocking, depending on the size of buffer space to send the corresponding large data, do not block send ()
ret = Send (..)
5. Close the connection
From for notes (Wiz)
Implementation of TCP servers and clients under Windows