![](http://datasheet.mmic.net.cn/Microchip-Technology/MCW1001AT-I-SS_datasheet_98973/MCW1001AT-I-SS_41.png)
2011 Microchip Technology Inc.
Preliminary
DS70671A-page 41
MCW1001A
6.11.4
SOCKET_BIND_MSG
(112 Command)
The Bind command associates a local IP address and port with a socket. This information allows the socket to advertise
its presence. As WiComm-Socket is always associated with only one local IP address, it is not required to supply the
local IP address in the Bind command. If the object of the bind process is a UDP socket, WiComm-Socket will attempt
to open the UDP port to remote connections. In this mode, the UDP socket can function as a server to accept client
messages which can be subsequently read from the socket. If this open process for the UDP port fails, the bind
response will return unsuccessful. It is not required to bind a UDP socket if its only purpose is to transmit as a client, or
if it will transmit before receiving from a remote connection. If the local port number is specified as zero, WiComm-
Socket will assign a non-zero value to the port beginning with 1024.
Response Message: SOCKET_BIND_RESPONSE_MSG
6.11.5
SOCKET_BIND_RESPONSE_MSG
(24 Response)
This message indicates the result of the attempted socket bind as either successful (0) or not (0xFF).
6.11.6
SOCKET_CONNECT_MSG
(113 Command)
For TCP sockets, the Connect command attempts to establish a connection between two sockets. For UDP sockets,
the Connect command specifies the peer or remote endpoint for the socket. The socket parameter specifies the local
socket to be used, and the remote address and port specify the peer or remote socket to connect. The Connect
command will perform an implicit bind for UDP sockets if not done previously. The Connect command is non-blocking
and will return immediately with a result of either Success (0), Connection In Process (0xFE), or Error (0xFF).
Response Message: SOCKET_CONNECT_RESPONSE_MSG
Msg Byte Index
Description
0:5
Header; Message Type = 112, Data Length = 4
6:7
Local Port Number to be associated with this socket
8
Socket Handle (previously created with SOCKET_CREATE_MSG)
9
Reserved
10
0x45 (Frame Trailer)
Msg Byte Index
Description
0:5
Header; Message Type = 24, Data Length = 4
6:7
Local Port Number bound to
8
Bind Result:
0 – Success
1-255 – Unsuccessful Bind
9
Reserved
10
0x45 (Frame Trailer)
Msg Byte Index
Description
0:5
Header; Message Type = 113, Data Length = 20
6
Socket Handle (previously created with SOCKET_CREATE_MSG)
7
Reserved
8:9
Remote Port Number to connect to
10:25
Remote IP address – for IPv4 the first 4 bytes are the IP address
26
0x45 (Frame Trailer)