19.01.2015 Views

Sockets Tutorial PDF file

Sockets Tutorial PDF file

Sockets Tutorial PDF file

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

* Input from the user ..<br />

gets(sbuf); /* sbuf -> receive input buffer */<br />

write(sd, sbuf , MAXBUFLEN); /* send the buf to the server*/<br />

* Receive data from the server side<br />

bp =rbuf; bytes_to_read = MAXBUFLEN;<br />

while((n = read(sd, bp , bytes_to_read)) > 0) {<br />

bp + = n; bytes_to_read - = n; }<br />

* Closing connection at client side<br />

close(sd);

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!