I started with networking today..THis piece of code is giving me some problem, can some one help me??
//sockfd is the socket descriptor that I am using to send and recv data.
buf1=malloc(sizeof(char)*50);//the starting address of hte space allocated is in buf1
buf11=buf1; //store the starting address in buf11
*buf1= '\0' ; // IS THIS REQD??
//buf1 is now pointing to the starting point of the segment allocated.
//i+1 is the total number of bytes to be sent
printf("bytes sent : %d\n",size);
printf("bytes to be sent %d\n",i+1);
server side :
// new_fd is the socket descriptor returned by accept()
printf("bytes recvd :%d\n",size);
I am able to recv only 4 or 5 characters ,though the size parameter(in the CLIENT side) has the right value ..and I get a segemntation fault..can some one help me out