Welcome to Scribd, the world's digital library. Read, publish, and share books and documents. See more
Download
Standard view
Full view
of .
Look up keyword
Like this
0Activity
0 of .
Results for:
No results containing your search query
P. 1
File1

File1

Ratings: (0)|Views: 0 |Likes:
Published by Nivi Senthil
2311
2311

More info:

Published by: Nivi Senthil on Sep 23, 2013
Copyright:Attribution Non-commercial

Availability:

Read on Scribd mobile: iPhone, iPad and Android.
download as DOCX, PDF, TXT or read online from Scribd
See more
See less

09/23/2013

pdf

text

original

 
#include<netinet/in.h>#include<string.h>int main(int argc,char*argv[]){int sockfd,clifd;socklen_t len;char name[10],int sockfd,clifd;socklen_t len;char name[10],int sockfd,clifd;socklen_t len;char name[10],size[5];char buf[100][200];FILE*f1,*f2,*f3;int i=0,j;struct sockaddr_in servaddr,cliaddr;sockfd=socket(AF_INET,SOCK_STREAM,0);if(sockfd<0)servaddr.sin_port=htons(5001);servaddr.sin_addr.s_addr=INADDR_ANY;bind(sockfd,(struct sockaddr*)&servaddr,sizeof(servaddr));listen(sockfd,0);len=sizeof(struct sockaddr);clifd=accept(sockfd,(struct sockaddr*)&clifd,&len);read(clifd,name,sizeof(name));
 
f1=fopen(name,"r");fgets(buf[i],200,f1);len=sizeof(struct sockaddr);clifd=accept(sockfd,(struct sockaddr*)&clifd,&len);read(clifd,name,sizeof(name));f1=fopen(name,"r");len=sizeof(struct sockaddr);clifd=accept(sockfd,(struct sockaddr*)&clifd,&len);read(clifd,name,sizeof(name));f1=fopen(name,"r");i++;while(!feof(f1)){fgets(buf[i],200,f1);i++;}snprintf(size,sizeof(size),"%d",i);//write(clifd,size,sizeof(size));f2=fopen("c.txt","w");for(j=0;j<i;j++){fputs(buf[j],f2);}write(clifd,"c.txt",sizeof("c.txt"));fclose(f1);fclose(f2);

You're Reading a Free Preview

Download
/*********** DO NOT ALTER ANYTHING BELOW THIS LINE ! ************/ var s_code=s.t();if(s_code)document.write(s_code)//-->