Prior to performing any socket-specific behavior, ISOCKET_Connect() will perform an ISOCKET_Realize() if necessary.
After establishment of a connection to the Internet, the callback is passed the error code that describes how the connect operation completed. As with all network callbacks, the callback is called within the same thread context, at some point in time after the caller returns control to the AEE event loop.
- pISocket:Pointer to the ISocket Interface object.
- a:IP Address.
- pfn:Address of the callback function that is invoked by AEE when the connect operation either succeeds or fails.
- pUser:User-defined data that is passed to the callback function when it is invoked.
int ISOCKET_Connect ( ISocket * pISocket, INAddr a, INPort wPort, PFNCONNECTCB pfn, void * pUser )
AEE_NET_ERROR: when a NULL callback pointer (pfn) was passed. This is the only case in which the callback will not be called.
The INAddr and INPort arguments are assumed to be in network byte order (for example, big-endian). This issue is important for portability across simulator environments and potential device targets. The callback is passed one of the following values describing the completion of the connect operation:
Local address requested via a prior call to ISOCKET_Bind() was not available.
Invalid socket descriptor is specfied
Connection attempt refused
IP address changed due to PPP resync
Invalid IP address and/or port specified
The socket is already connected (result was already received by a previous call to Connect())
Not enough network resources to complete this operations (too many sockets in use). AEE_NET_ENETDOWN
Network is not available (e.g. handset outside of coverage area)
Socket type is not STREAM.
Connection attempt timed out
Connect completed successfully; socket is prepared for reading and/or writing.