The SockServer is an application providing a set of services that the WiFi Driver Validation uses to test the Socket interface of the WiFi driver and is located in the .\Tools\SockServer subdirectory of the pack root directory. The SockServer runs several standard network services.
The following services are available by SockServer:
- Echo service on port 7, TCP and UDP
(two instances of TCP service, one instance of UDP service)
- Discard service on port 9, TCP and UDP
(one instance of TCP service, one instance of UDP service)
- Chargen service on port 19, TCP and UDP
(two instances of TCP service, one instance of UDP service)
- Assistant service on port 5000
(helper service used to test WiFi sockets in server mode (socket accept functionality))
- Telnet service on port 23
(SockServer status monitoring service)
The SockServer also supports a telnet connection, which gives you information about received and sent data. This can help resolve driver problems when Wifi socket sending and receiving does not work well. For example, when the transfer test fails, you don't know if the SocketSend or SocketRecv functions have failed or both.
For the telnet connection, at the command prompt, type the following command or use another telnet client application.
The initial page opens:
Initial telnet connection
You can view the remote IP address, port number, receiving and transmitting counters with the stat command:
Status monitoring
Status monitor constantly updates the SockServer status on the screen. To stop the screen update, press any telnet client key.
WiFi drivers need to be tested in the wireless local area network. The testing environment contains the following equipment:
- WiFi router or Access Point with access to the Internet
- board running SockServer application and connected to the same network with Ethernet cable
- evaluation board with the WiFi module used for testing
Porting SockServer
Currently, the SockServer application is available for the MCB4300 and MCBSTM32F400 evaluation boards. To create SockServer application for a different microcontroller, you need to do the following:
- Create new network project in uVision
- Select and configure the RTE Components:
- Network:Core and configure the host name and pool size in Net_Config.c
#define NET_HOST_NAME "SockServer"
#define NET_MEM_POOL_SIZE 16384
- Network:Interface:Ethernet and configure the MAC address in Net_Config_ETH0.h to avoid collisions
#define ETH0_MAC_ADDR "1E-30-6C-A2-45-5A"
- Network:Socket:BSD and configure number of sockets in Net_Config_BSD.h
#define BSD_NUM_SOCKS 8
#define BSD_SERVER_SOCKS 4
- Network:Socket:TCP and configure number of sockets in Net_Config_TCP.h
- Network:Socket:UDP and configure number of sockets in Net_Config_UDP.h
- Network:Service:Telnet server and disable authentication in Net_Config_Telnet_Server.h
#define TELNET_SERVER_AUTH_ENABLE 0
- CMSIS Driver:Ethernet/MAC/PHY(API) depending on your hardware
- Configure device specific hardware:
- Configure the CMSIS Ethernet driver and other device specific components (clock system, I/O, ...) as required. Please consult your device's/board's documentation for more information.
- Copy SockServer.c and SockServer.h files and add the first to the project
- Copy Telnet_Server_UIF.c and add it to the project
- Add the code to start the services in main.c
static void app_main (void *argument) {
netInitialize ();
osDelay (500);
osThreadNew(DgramServer, NULL, NULL);
osThreadNew(StreamServer, NULL, NULL);
osThreadNew(TestAssistant, NULL, NULL);
}
- Increase default RTX stack size to 400 bytes in RTX_Config.h
#define OS_STACK_SIZE 400
- Set default global stack to 1024 bytes and heap to 6144 bytes in startup file
Stack_Size EQU 0x00000400
Heap_Size EQU 0x00001800