The UNIX Operating System

TOP

UP


Ray Seyfarth

ORCA


Computer Science

COST

USM




Closing a TCP Connection


  • In the simplest case close works well

  • Sometimes it is important to tell the server that a client will send no more requests, while still keeping the socket available for reading.
    res = shutdown ( s, 1 );
    

  • The 1 means no more writes will happen

  • The server detects end of file on the socket

  • After the server sends all the replies it can close


University of Southern Mississippi
Ray.Seyfarth@usm.edu
Updated 20:05 Jun 5, 2000