Difference between revisions of "Architecture/Lecture/read write vs send receive"
From Apache OpenOffice Wiki
< Architecture | Lecture
m (New page: =read/write are not portable recv/send are= while calling read/write on sockets in unices is perfectly ok because "everything in Unix is a file" and therefor a socket is also represented ...) |
B michaelsen (Talk | contribs) |
||
Line 13: | Line 13: | ||
*MSG_OOB Requests out-of-band data. The significance and semantics of out-of-band data are protocol-specific. | *MSG_OOB Requests out-of-band data. The significance and semantics of out-of-band data are protocol-specific. | ||
*MSG_WAITALL on SOCK_STREAM sockets this requests that the function block until the full amount of data can be returned. The function may return a smaller amount of data if the socket is a message-based socket, if a signal is caught, if the connection is terminated, if MSG_PEEK was specified, or if an error is pending for the socket. | *MSG_WAITALL on SOCK_STREAM sockets this requests that the function block until the full amount of data can be returned. The function may return a smaller amount of data if the socket is a message-based socket, if a signal is caught, if the connection is terminated, if MSG_PEEK was specified, or if an error is pending for the socket. | ||
+ | [[Category:Architecture]] |
Latest revision as of 16:01, 24 November 2009
read/write are not portable recv/send are
while calling read/write on sockets in unices is perfectly ok because "everything in Unix is a file" and therefor a socket is also represented as a file descriptor, this is not the case for Windows. (the equivalent functions here would be ReadFile() and WriteFile() ) Basically in Windows socket functions create socket handles, which are disjoint from the file descriptor system.
on a minor note there is an additional parameter to provide for recv/send which specifies the type of message reception
- MSG_PEEK Peeks at an incoming message. The data is treated as unread and the next recv() or similar function shall still return this data.
- MSG_OOB Requests out-of-band data. The significance and semantics of out-of-band data are protocol-specific.
- MSG_WAITALL on SOCK_STREAM sockets this requests that the function block until the full amount of data can be returned. The function may return a smaller amount of data if the socket is a message-based socket, if a signal is caught, if the connection is terminated, if MSG_PEEK was specified, or if an error is pending for the socket.