[CC]TCP Client Algorithm and UDP Client Algorithm

TCP Clent Algorithm:

1.Find the IP address and protocol port number of the server with which communication is desired.

2.Allocate a socket.

3.Specify that the connection needs an arbitrary, unused protocol port on the local machine, and allow TCP to choose one.

4.Connect the socket to the server.

5.Communicate with the server using the application-level protocol(this ususlly involves sending requesets and awaiting replies).

6.Close the connection.

 

 

UDP Client Algorithm

1.Same as above(TCP).

2.Same as above(TCP).

3.Specify that the communication needs an arbitrary, unused protocol port on the local machine, and allow UDP to choose one.

4.Specify the server to which messages must be sent.

5.Same as above(TCP)

6.Close the socket.

你可能感兴趣的:(Algorithm)