VirtualBox

Changeset 31103 in vbox for trunk/include/iprt


Ignore:
Timestamp:
Jul 26, 2010 10:58:27 AM (15 years ago)
Author:
vboxsync
Message:

IPRT/Socket: Add non blocking versions of the read/write methods. The mode is switched on demand.

Location:
trunk/include/iprt
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/include/iprt/socket.h

    r30468 r31103  
    226226RTDECL(int) RTSocketSgWriteLV(RTSOCKET hSocket, size_t cSegs, va_list va);
    227227
     228/**
     229 * Receive data from a socket.
     230 *
     231 * This version doesn't block if there is no data on the socket.
     232 *
     233 * @returns IPRT status code.
     234 *
     235 * @param   hSocket         The socket handle.
     236 * @param   pvBuffer        Where to put the data we read.
     237 * @param   cbBuffer        Read buffer size.
     238 * @param   pcbRead         Number of bytes read.
     239 */
     240RTDECL(int) RTSocketReadNB(RTSOCKET hSocket, void *pvBuffer, size_t cbBuffer, size_t *pcbRead);
     241
     242/**
     243 * Send data to a socket.
     244 *
     245 * This version doesn't block if there is not enough room for the message.
     246 *
     247 * @returns IPRT status code.
     248 *
     249 * @param   hSocket         The socket handle.
     250 * @param   pvBuffer        Buffer to write data to socket.
     251 * @param   cbBuffer        How much to write.
     252 * @param   pcbWritten      Number of bytes written.
     253 */
     254RTDECL(int) RTSocketWriteNB(RTSOCKET hSocket, const void *pvBuffer, size_t cbBuffer, size_t *pcbWritten);
     255
     256/**
     257 * Send data from a scatter/gather buffer to a socket.
     258 *
     259 * This version doesn't block if there is not enough room for the message.
     260 *
     261 * @returns iprt status code.
     262 *
     263 * @param   Sock        Socket descriptor.
     264 * @param   pSgBuf      Scatter/gather buffer to write data to socket.
     265 * @param   pcbWritten  Number of bytes written.
     266 */
     267RTR3DECL(int)  RTSocketSgWriteNB(RTSOCKET Sock, PCRTSGBUF pSgBuf, size_t *pcbWritten);
     268
     269
     270/**
     271 * Send data from multiple buffers to a socket.
     272 *
     273 * This version doesn't block if there is not enough room for the message.
     274 * This is convenience wrapper around the RTSocketSgWrite and RTSgBufInit calls
     275 * for lazy coders.  The "L" in the function name is short for "list" just like
     276 * in the execl libc API.
     277 *
     278 * @returns IPRT status code.
     279 *
     280 * @param   hSocket         The socket handle.
     281 * @param   cSegs           The number of data segments in the following
     282 *                          ellipsis.
     283 * @param   pcbWritten      Number of bytes written.
     284 * @param   ...             Pairs of buffer pointers (void const *) and buffer
     285 *                          sizes (size_t).  Make 101% sure the pointer is
     286 *                          really size_t.
     287 */
     288RTR3DECL(int) RTSocketSgWriteLNB(RTSOCKET hSocket, size_t cSegs, size_t *pcbWritten, ...);
     289
     290/**
     291 * Send data from multiple buffers to a socket.
     292 *
     293 * This version doesn't block if there is not enough room for the message.
     294 * This is convenience wrapper around the RTSocketSgWrite and RTSgBufInit calls
     295 * for lazy coders.  The "L" in the function name is short for "list" just like
     296 * in the execl libc API.
     297 *
     298 * @returns IPRT status code.
     299 *
     300 * @param   hSocket         The socket handle.
     301 * @param   cSegs           The number of data segments in the following
     302 *                          argument list.
     303 * @param   pcbWritten      Number of bytes written.
     304 * @param   va              Pairs of buffer pointers (void const *) and buffer
     305 *                          sizes (size_t). Make 101% sure the pointer is
     306 *                          really size_t.
     307 */
     308RTR3DECL(int) RTSocketSgWriteLVNB(RTSOCKET hSocket, size_t cSegs, size_t *pcbWritten, va_list va);
     309
    228310/** @} */
    229311RT_C_DECLS_END
  • trunk/include/iprt/tcp.h

    r30468 r31103  
    331331RTR3DECL(int) RTTcpSgWriteLV(RTSOCKET hSocket, size_t cSegs, va_list va);
    332332
     333/**
     334 * Receive data from a socket.
     335 *
     336 * This version doesn't block if there is no data on the socket.
     337 *
     338 * @returns IPRT status code.
     339 *
     340 * @param   Sock        Socket descriptor.
     341 * @param   pvBuffer    Where to put the data we read.
     342 * @param   cbBuffer    Read buffer size.
     343 * @param   pcbRead     Number of bytes read.
     344 */
     345RTR3DECL(int)  RTTcpReadNB(RTSOCKET Sock, void *pvBuffer, size_t cbBuffer, size_t *pcbRead);
     346
     347/**
     348 * Send data to a socket.
     349 *
     350 * This version doesn't block if there is not enough room for the message.
     351 *
     352 * @returns IPRT status code.
     353 *
     354 * @param   Sock        Socket descriptor.
     355 * @param   pvBuffer    Buffer to write data to socket.
     356 * @param   cbBuffer    How much to write.
     357 * @param   pcbWritten  Number of bytes written.
     358 */
     359RTR3DECL(int)  RTTcpWriteNB(RTSOCKET Sock, const void *pvBuffer, size_t cbBuffer, size_t *pcbWritten);
     360
     361/**
     362 * Send data from a scatter/gather buffer to a socket.
     363 *
     364 * This version doesn't block if there is not enough room for the message.
     365 *
     366 * @returns iprt status code.
     367 * @retval  VERR_INTERRUPTED if interrupted before anything was written.
     368 *
     369 * @param   Sock        Socket descriptor.
     370 * @param   pSgBuf      Scatter/gather buffer to write data to socket.
     371 * @param   pcbWritten  Number of bytes written.
     372 */
     373RTR3DECL(int)  RTTcpSgWriteNB(RTSOCKET Sock, PCRTSGBUF pSgBuf, size_t cbWritten);
     374
     375
     376/**
     377 * Send data from multiple buffers to a socket.
     378 *
     379 * This version doesn't block if there is not enough room for the message.
     380 * This is convenience wrapper around the RTSocketSgWrite and RTSgBufInit calls
     381 * for lazy coders.  The "L" in the function name is short for "list" just like
     382 * in the execl libc API.
     383 *
     384 * @returns IPRT status code.
     385 *
     386 * @param   hSocket         The socket handle.
     387 * @param   cSegs           The number of data segments in the following
     388 *                          ellipsis.
     389 * @param   pcbWritten      Number of bytes written.
     390 * @param   ...             Pairs of buffer pointers (void const *) and buffer
     391 *                          sizes (size_t).  Make 101% sure the pointer is
     392 *                          really size_t.
     393 */
     394RTR3DECL(int) RTTcpSgWriteLNB(RTSOCKET hSocket, size_t cSegs, size_t *pcbWritten, ...);
     395
     396/**
     397 * Send data from multiple buffers to a socket.
     398 *
     399 * This version doesn't block if there is not enough room for the message.
     400 * This is convenience wrapper around the RTSocketSgWrite and RTSgBufInit calls
     401 * for lazy coders.  The "L" in the function name is short for "list" just like
     402 * in the execl libc API.
     403 *
     404 * @returns IPRT status code.
     405 *
     406 * @param   hSocket         The socket handle.
     407 * @param   cSegs           The number of data segments in the following
     408 *                          argument list.
     409 * @param   pcbWritten      Number of bytes written.
     410 * @param   va              Pairs of buffer pointers (void const *) and buffer
     411 *                          sizes (size_t). Make 101% sure the pointer is
     412 *                          really size_t.
     413 */
     414RTR3DECL(int) RTTcpSgWriteLVNB(RTSOCKET hSocket, size_t cSegs, size_t *pcbWritten, va_list va);
     415
    333416/** @} */
    334417RT_C_DECLS_END
Note: See TracChangeset for help on using the changeset viewer.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette