read from socket

view full story

http://www.unix.com – hello I have a C program and I want to read data from a socket ,and especially I want a client to send a .jpg to the server.The problem I face is that no matter what the size of the photo is,my read command seems to read an amount of data and then does nothing. Code: while(1){   if(read(sockdes,&c,sizeof c)<=0){       perror("read");       break;   } } The strange thing is that perror doesn't print anything,which means that read is successful,also I checked if I closed the socket in the server code,but I do not. (HowTos)