You are on page 1of 2

#include <sys/socket.

h>
#include <sys/types.h>
#include <netinet/in.h>
#include <arpa/inet.h>
#include <stdio.h>

#define PORT 2080

main!
"
int sock#$
sock# %
socket&'()*+T,-O./(-TR+&0,0!$
struct sockaddr(in ser1$

ser1.sin(port % htonsPORT!$
printf234
345n2,PORT,htonsPORT!!$
ser1.sin(family % &'()*+T$
ser1.sin(addr.s(addr %
inet(addr2#26.0.0.#2!$
printf2client
connectin75n2!$
connectsock#, struct
sockaddr 8!9ser1,si:eofser1!!$
char ;uf<=0>$
')?+8 fp %
fopen2client.t4t2,2@2!$
@hile#!"

//;:ero;uf,si:eof;uf!!$
readsock#,;uf,=0!$

ifstrcmp;uf,2Auit#2BC2!%%0!
"
;reak$
D

fprintffp,23s2,;uf!$
D
fclosefp!$
D

You might also like