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

Developer

API Reference

ISOCKET_RECVFROM()

Brew Release
Brew MP 1.0.2
See Also
Description
This functions reads data from UDP socket and records the IP address and port of the sender if non-NULL. This function always returns immediately with the number of bytes read. If no packets have arrived and the socket is still in a valid state, ISOCKET_RecvFrom() returns AEE_NET_WOULDBLOCK. ISOCKET_Readable() may be used to receive notification of when to try ISOCKET_RecvFrom() again.
Prior to performing any socket-specific behavior, ISOCKET_RecvFrom() performs an ISOCKET_Realize() if neccesary.
Params
pISocket
[]:
Pointer to the ISocket Interface object.
pBuff
[]:
Buffer to hold the received data.
wBytes
[]:
Size of the buffer, in terms of number of bytes.
wflags
[]:
Data transport options.
pa
[]:
Pointer to the IP Address in network byte order. May be NULL only if not of interest to the application.
pwPort
[]:
Pointer to the port in network byte order. May be NULL only if not of interest to the application.
Interface
  • ISOCKET
Prototype
  •     int32 ISOCKET_RecvFrom
        (
         ISocket * pISocket,
         byte *pBuff,
         uint16 wbytes,
         uint16 wflags,
         INAddr * pa,
         INPort * pwPort
        )
    
Return
  • bytes_read: any positive number indicates the number of bytes that have been successfully read into the provided buffer.
    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. The specific error code can be retrieved by calling ISOCKET_GetLastError().
Side Effect
  • None.
Comments
The specific error code can be retrieved by calling ISOCKET_GetLastError() and one of the following error codes is returned: AEE_NET_EEOF End of file. AEE_NET_EBADF Invalid socket descriptor is specified. AEE_NET_EAFNOSUPPORT Address family not supported. AEE_NET_ENETDOWN Network subsystem unavailable. AEE_NET_EFAULT Application buffer not valid part of address space. AEE_NET_EOPNOTSUPP Option not supported. AEE_NET_GENERAL_FAILURE General failure.