A better way to read in a file and send it would be like this:
This is of course assuming it's always a text file you're sending.Code:{ char file[MAXDATASIZE]; while(fgets(file, sizeof(file), local_file)) { if(feof(local_file)) break; printf("%s", file); write(socket, file, strlen(file)); } }