Information Technology Reference
In-Depth Information
Server
socket()
bind()
listen()
Client
accept()
socket()
Blocks until connection
received from client
Connection
Estabilishment
connect()
read()
write()
write()
read()
close()
close()
Figure 2.1.
Socket calls for a connection-oriented protocol.
piggybacking [107] are used. To overcome this, we provide a set of utility routines
to read the remaining bytes, in the case of a read call, or output the remaining
bytes, in the case of a write call.
int readline(int socket, char ∗buffer, int len);
int writeline(int socket, char ∗ buffer, int bytes);
Our server implementation is as follows:
extern int writeline(int socket, char ∗buffer,int bytes);
int main(int argc, char ∗∗ argv) {
int sock;
struct sockaddr_in server;
 
Search WWH ::




Custom Search