code_junkie

Problem with Closing Sockets. Program Halts

Nov 13th, 2011
123
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.40 KB | None | 0 0
  1. int SendBinary(int *byte, int length)
  2. {
  3. int bytes_sent;
  4.  
  5. bytes_sent = send(connecting_socket, byte, length, 0);
  6.  
  7. return bytes_sent;
  8.  
  9.  
  10. return 0;
  11. }
  12.  
  13. void SendFile(FILE *fp, int file_size)
  14. {
  15. int current_char = 0;
  16.  
  17. do{
  18. current_char = fgetc(fp);
  19.  
  20. if ( current_char == EOF )
  21. break;
  22.  
  23. SendBinary(&current_char, sizeof(char));
  24. }
  25. while(current_char != EOF);
  26.  
  27. }
Add Comment
Please, Sign In to add comment