Explain Sending / Receiving Data in socket programming?
ceeser 26-October-2007 05:20:00 PM

Comments


www.cse.psu.edu/~johansen/cse458/notes/socketprogramming.pdf -
Posted by waqasahmad


* With a connection (SOCK_STREAM):
- int count = send(sock, &buf, len, flags);
- count: # bytes transmitted (-1 if error)
- buf: char[], buffer to be transmitted
- len: integer, length of buffer (in bytes) to transmit
- flags: integer, special options, usually just 0
* int count = recv(sock, &buf, len, flags);
- count: # bytes received (-1 if error)
- buf: void[], stores received bytes
- len: # bytes received
- flags: integer, special options, usually just 0
*Calls are blocking [returns only after data is sent (to socket buf) / received]

Posted by suresh123



Posted: 26-October-2007 05:32:15 PM By: suresh123

* With a connection (SOCK_STREAM):
- int count = send(sock, &buf, len, flags);
- count: # bytes transmitted (-1 if error)
- buf: char[], buffer to be transmitted
- len: integer, length of buffer (in bytes) to transmit
- flags: integer, special options, usually just 0
* int count = recv(sock, &buf, len, flags);
- count: # bytes received (-1 if error)
- buf: void[], stores received bytes
- len: # bytes received
- flags: integer, special options, usually just 0
*Calls are blocking [returns only after data is sent (to socket buf) / received]

Posted: 31-December-2008 12:10:08 AM By: waqasahmad

www.cse.psu.edu/~johansen/cse458/notes/socketprogramming.pdf -