API Reference | developer.brewmp.com API Reference | developer.brewmp.com

Developer

API Reference

ISOCKET_WRITE()

Brew Release
Brew MP 1.0.2
See Also
ISOCKET_Read() ISOCKET_ReadV() ISOCKET_WriteV()
Description
This function writes data to a connected socket from a single buffer. This function always returns immediately with the number of bytes that were successfully written. If no bytes can be successfully written and the connection is still active, ISOCKET_Write() returns AEE_NET_WOULDBLOCK. To be notified when to call again, the caller must call ISOCKET_Writeable().
Params
pISocket
[]:
Pointer to the I ISocket Interface object.
pBuffer
[]:
Pointer to the buffer from which the data is sent.
wBytes
[]:
Specifies the size of the buffer in terms of number of bytes in the buffer.
Interface
  • ISOCKET
Prototype
  •     int32 ISOCKET_Write(ISocket * pISocket, byte * pBuffer, uint32 wBytes)
    
Return
  • bytes_written: ( > 0), Any positive number indicates the number of bytes successfully written.
    AEE_NET_WOULDBLOCK: No bytes can be written at this time; try again later (See ISOCKET_Writeable()).
    AEE_NET_ERROR, Failed to write any bytes.
Side Effect
  • None.
Comments
The specific error code can be retrieved by calling ISOCKET_GetLastError(). One of the following possible error codes is returned. AEE_NET_EBADF Invalid socket descriptor is specified. AEE_NET_ENOTCONN Socket not connected. AEE_NET_ECONNRESET TCP connection reset by server. AEE_NET_ECONNABORTED TCP connection aborted because of a time-out or other failure. AEE_NET_EIPADDRCHANGED IP address changed, causing TCP connection reset. AEE_NET_EPIPE Broken pipe. AEE_NET_ENETDOWN Network subsystem unavailable. AEE_NET_EFAULT Application buffer not valid part of address space. AEE_NET_GENERAL_FAILURE General failure. AEE_NET_ESHUTDOWN Connection is shutdown for writing.