| iMatix home page
| << | < | > | >>
SFL Logo SFL
Version 2.11

 

write_TCP

#include "sflsock.h"
int
write_TCP (
    sock_t handle,                      /*  Socket handle                    */
    const void *buffer,                 /*  Buffer containing data           */
    size_t length                       /*  Amount of data to write          */
)

Synopsis

Writes data to the socket. On UNIX, VMS, OS/2, calls the standard write function; some other systems have particular ways of accessing sockets. If there is an error on the write this function returns SOCKET_ERROR. You can handle errors (in sockerrno) as fatal except for EAGAIN which indicates that the operation would cause a non-blocking socket to block, and EPIPE or ECONNRESET which indicate that the socket was closed at the other end. Treat EWOULDBLOCK as EAGAIN.

Source Code - (sflsock.c)

{
#if (defined (DOES_SOCKETS))
#   if (defined (__UTYPE_BEOS))
    return (send ((SOCKET) handle, buffer, length, 0));

#   elif (defined (__UNIX__) || defined (__VMS__) || defined (__OS2__))
    return (write ((SOCKET) handle, buffer, length));

#   elif (defined (__WINDOWS__))
    int
        rc;                             /*  Return code from call            */

    ASSERT (buffer);
    rc = send ((SOCKET) handle, buffer, length, 0);
    return (win_error (rc));
#   else
#       error "No code for function body."
#   endif
#else
    return ((int) SOCKET_ERROR);        /*  Sockets not supported            */
#endif
}

| << | < | > | >> iMatix Copyright © 1996-2000 iMatix Corporation