Hi,
Could anyone direct me as to whether there is a special way of sending images (specifically .jpeg files) across a tcp socket? So far I am developing a webserver that seems to send all the text data well. When it comes to jpeg images, the headers are sent however, the Cygwin console just freezes when it comes to sending the actual data.
The way that I am sending the data is that I first open the file, read the data into a buffer and then push that across. Any suggestions?
while(!feof(sendFile)){
bzero(send_buffer,sizeof(send_buffer));
result = fread (send_buffer,1,sizeof(send_buffer),sendFile);
while(result>0){
result = fread (send_buffer,1,sizeof(send_buffer),sendFile);
if(ferror(sendFile)){
printf("Error reading file: %s\n",request_page);
}
if((test=send(new_fd,send_buffer,sizeof(send_buffer),0))<0){
printf("Send returned %d\n",test);
printf("Sending %s Failed\n", request_page);
exit(1);
}
bzero(send_buffer,sizeof(send_buffer));
}
}
fclose(sendFile);