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

Developer

API Reference

ISOCKET_READ()

Brew Release
Brew MP 1.0.2
See Also
ISOCKET_ReadV() ISOCKET_Write() ISOCKET_WriteV()
Description
This function reads data from a socket into a single buffer specified as a parameter to this function. This function always returns immediately. If there is no data available and the connection is still active, ISOCKET_Read() returns AEE_NET_WOULDBLOCK. To be notified when to call ISOCKET_Read() again, the caller must call ISOCKET_Readable().
Params
pISocket
[]:
Pointer to the ISocket Interface object.
pbDest
[]:
Pointer to the buffer to hold the data that is to be received.
wSize
[]:
Specifies the number of bytes to read.
Interface
  • ISOCKET
Prototype
  •     int32 ISOCKET_Read(ISocket * pISocket, byte * pbDest, uint32 wSize)
    
Return
  • - bytes_read, any positive number indicates the number of bytes that have been
    successfully read into the provided buffer. - 0 (zero), if there is no more data to be received; the peer has shut down the
    connection. - AEE_NET_WOULDBLOCK, if no data available now; try again later (See ISOCKET_Readable()).

    - AEE_NET_ERROR, if the socket is not in a valid state to receive data.
Side Effect
  • None.
Comments
The specific error code can be retrieved by calling ISOCKET_GetLastError(). Error codes 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 reading.