When a socket is created with a call to the socket function, it exists in a name space (address family), but it has no name assigned to it. Passing AEE_INADDR_ANY (zero) for the address explicitly requests that the socket be assigned to any local address. Passing AEE_BREW_LOOPBACK allows local connections. Passing a multicast group address can be used for receiving multicast traffic destined to that group, if the selected network is a multicast network, such as MediaFLO or CDMA BCMCS. On other networks, multicast is not supported yet.
NOTE: The ability to bind to a specific local IP address is not presently supported, and the above options are the only valid values for the INAddr parameter. In the case of AEE_INADDR_ANY, the local IP address is assigned automatically by the sockets library.
Also note the possibility of an AEE_NET_WOULDBLOCK result. This typically occurs only in cases where a network connection, such as a PPP link, must be established. In that event, Bind() returns AEE_NET_WOULDBLOCK, and can be called again to obtain the final result (error or success). For notification of when to call Bind() again, the ISOCKET_Writeable() call can be used. (Note that just as with Write(), a ISOCKET_Writeable() callback does not guarantee that a subsequent call to Bind() will complete, so the caller must be prepared to receive AEE_NET_WOULDBLOCK again.)
The user is not required to call Bind() until a non-WOULDBLOCK result is returned. The user can proceed to attempt to connect, send or receive data using ISOCKET_Connect(), ISOCKET_SendTo() or ISOCKET_RecvFrom(), in which case the bind operation (and any network startup) proceeds in the background, and any failure in startup phases is reflected in an ISOCKET_Connect(), ISOCKET_SendTo(), or ISOCKET_RecvFrom() error result.
int ISOCKET_Bind(ISocket * pISocket, INAddr addr, uint16 wPort)
- AEE_NET_SUCCESS: if successful. AEE_NET_ERROR: on error. AEE_NET_WOULDBLOCK: if operation is blocked. call ISOCKET_Writeable() and ISOCKET_Bind() when the callback occurs.