![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
To set up a socket connection, the server must do the following:
socket
.
bind
.
listen
.
Then, once the server is listening, the client can do the following:
socket
.
connect
.
Then, once the client has attempted to establish a connection to the listening server, the server can do the following:
accept
.
Finally, once the connection is accepted, both the server and client can do the following:
fdopen
, an acronym for file descriptor
open.
The pointer variables that are assigned to the values returned from calls
to fdopen
are like the file pointers assigned to the values
returned from calls to fopen
. You soon see,
in the hardcopy version of this book,
that a program can read
and write to the socket using those pointer variables as arguments to
fscanf
and fprintf
.