22.07.2013 Views

Download File

Download File

Download 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.

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

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

WEEK 8:<br />

Aim: Design UDP client and server application to reverse the given input sentence<br />

/* udp_strrev_ser.c */<br />

/* UDP echo client/server with select() (timeout option). See udpClient.c */<br />

#include <br />

#include <br />

#include <br />

#include <br />

#include <br />

#include <br />

#include <br />

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

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

#define LOCAL_SERVER_PORT 1500<br />

#define MAX_MSG 100<br />

int main(int argc, char *argv[])<br />

{<br />

int l,x,y;<br />

char swp;<br />

int sd, rc, n, cliLen, flags;<br />

struct sockaddr_in cliAddr, servAddr;<br />

char msg[MAX_MSG];<br />

/* socket creation */<br />

sd=socket(AF_INET, SOCK_DGRAM, 0);<br />

if(sd

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

Saved successfully!

Ooh no, something went wrong!