A simple example with Socket

A simple example with Socket

Concepts:

  1. socket:

  2. thread

  3. I/O stream

    Output stream -> Sending buffer queue (SendQ)-> Network

    Network-> Receiving buffer queue (RecvQ)->Input Stream

Example:

Write a net program, include a server and client, client will send a string to the server, and server should print the string to the terminal, and return the length of string to the client, and finally the client should print the length sent from server. You should do it in TCP and UDP way.

Your browser is out-of-date!

Update your browser to view this website correctly. Update my browser now

×