22.07.2013 Views

Download File

Download File

Download File

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

Subject: NETWORK PROGRAMMING LAB Year : 2010<br />

Class : IV B-Tech C.S.E Semester: First<br />

/*udp_str_clnt.c*/<br />

#include /* for exit() */<br />

#include <br />

#include <br />

#include <br />

#include <br />

#include <br />

#include <br />

#include <br />

#include /* memset() */<br />

#include /* select() */<br />

#define REMOTE_SERVER_PORT 1500<br />

#define MAX_MSG 100<br />

#define SOCKET_ERROR -1<br />

int isReadable(int sd,int * error,int timeOut)<br />

{<br />

// milliseconds<br />

fd_set socketReadSet;<br />

FD_ZERO(&socketReadSet);<br />

FD_SET(sd,&socketReadSet);<br />

struct timeval tv;<br />

if (timeOut)<br />

{<br />

tv.tv_sec = timeOut / 1000;<br />

tv.tv_usec = (timeOut % 1000) * 1000;<br />

}<br />

else<br />

{<br />

} // if<br />

tv.tv_sec = 0;<br />

tv.tv_usec = 0;<br />

NP Lab Manual , RNEC page: 62

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

Saved successfully!

Ooh no, something went wrong!