Advertisement
Guest User

Untitled

a guest
Mar 31st, 2020
83
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.50 KB | None | 0 0
  1. int receive_and_send(int connfd1, int connfd2)
  2. {
  3.     char buf[BUFLEN];
  4.     int bytes_send;
  5.     int bytes_remaining;
  6.     int bytes_received = 0;
  7.  
  8.     // TODO 6: Receptionati un mesaj de la connfd1
  9.     bytes_received = recv(connfd1, buf, BUFLEN, 0);
  10.  
  11.     if (bytes_received != 0) {
  12.         fprintf(stderr, "Received: %s", buf);
  13.     }
  14.  
  15.     bytes_remaining = bytes_received;
  16.  
  17.     // TODO 7: Timiteti mesajul la connfd2
  18.     send(connfd2, buf, bytes_remaining, 0);
  19.  
  20.     return bytes_received;
  21. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement