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 9:<br />

Aim: Design UDP client server to transfer a file<br />

/* server program */<br />

/* udp_file_ser.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 3000<br />

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

{<br />

FILE*f;<br />

int i=0;<br />

char fname[100],ch;<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!