MCW1001A
DS70671A-page 46
Preliminary
2011 Microchip Technology Inc.
6.11.20
SOCKET_ALLOCATE_MSG
(122 COMMAND)
WiComm-Socket has a limited amount of buffer space available for TCP sockets. The current total memory space
available to all TCP sockets is 8192 bytes. Each TCP socket can be used in a client or server configuration, and every
socket must have a receive buffer and a transmit buffer. By default, there are 8 TCP sockets defined. 6 of them are
predefined as server sockets, and 2 of them are predefined as client sockets. The available 8K of memory is split evenly
between the 8 sockets and split evenly again between the transmit and receive buffers so that every buffer is allocated
a total of 512 bytes. The host may customize the allocation of socket memory, not to exceed 8 total TCP sockets.
However, the allocation must be the same for all server sockets and all client sockets. The SOCKET_ALLOCATE_MSG
allows the size of the transmit and receive buffers to be set for server sockets and client sockets, and the count for each
socket type to be defined. The total socket count (server+client) must not exceed 8, and the total buffer allocation must
not exceed 8192 bytes. This command should be executed shortly after initialization prior to establishing a Wi-Fi
connection as it will reinitialize the TCP stack.
Response Message: SOCKET_ALLOCATE_RESPONSE_MSG
6.11.21
SOCKET_ALLOCATE_RESPONSE_MSG
(32 RESPONSE)
This message indicates the result of the attempted socket allocation command. If successful, the result field returned
will be 0. If the result is 0xFF, the maximum number of sockets was exceeded, and if the result is 0xFE, the total buffer
allocation size was exceeded.
Msg Byte Index
Description
0:5
Header; Message Type = 122, Data Length = 10
6
TCP Server Socket Count
7
TCP Client Socket Count
8:9
TCP Server Socket Receive Buffer Size (bytes)
10:11
TCP Server Socket Transmit Buffer Size (bytes)
12:13
TCP Client Socket Receive Buffer Size (bytes)
14:15
TCP Client Socket Transmit Buffer Size (bytes)
16
0x45 (Frame Trailer)
Msg Byte Index
Description
0:5
Header; Message Type = 32, Data Length = 2
6
Result (see description)
7
Allocated Socket Count
8
0x45 (Frame Trailer)