2021-06-15 04:01 AM
First I initialize it
if(ISM43362_Init() == WIFI_STATUS_OK)
{
USART_SendString(SYS_USART, "WIFI INIT OK\r");
if(WIFI_GetMAC_Address(mac_addr) == WIFI_STATUS_OK)
USART_SendString(SYS_USART, "MAC ADDRESS ");
USART_SendHex(SYS_USART, mac_addr[0],0);
USART_SendString(SYS_USART, ":");
USART_SendHex(SYS_USART, mac_addr[1],0);
USART_SendString(SYS_USART, ":");
USART_SendHex(SYS_USART, mac_addr[2],0);
USART_SendString(SYS_USART, ":");
USART_SendHex(SYS_USART, mac_addr[3],0);
USART_SendString(SYS_USART, ":");
USART_SendHex(SYS_USART, mac_addr[4],0);
USART_SendString(SYS_USART, ":");
USART_SendHex(SYS_USART, mac_addr[5],1);
}
}
else
USART_SendString(SYS_USART, "WIFI INIT ERROR\r");
Got OK.
Then connect
if( WIFI_Connect(SSID, PASSWORD, WIFI_ECN_WPA2_PSK) == WIFI_STATUS_OK)
{
if(WIFI_GetIP_Address(ip_addr) == WIFI_STATUS_OK)
{
USART_SendString(SYS_USART, "Connected: got IP Address ");
}
else
{
USART_SendString(SYS_USART , "ERROR: CANNOT get IP address\r");
}
}
Got IP.
Now I start a server
if (WIFI_StartServer(SOCKET, WIFI_UDP_PROTOCOL, 1, "", PORT) == WIFI_STATUS_OK)
USART_SendString(SYS_USART, "Start server - SUCCESS\r");
else
USART_SendString(SYS_USART, "Start server - ERROR\r");
Here I get - ES_WIFI_STATUS_UNEXPECTED_CLOSED_SOCKET.
What could be wrong?
2021-06-15 05:36 AM
Well...Seems like I can start a server only on WIFI_TCP_PROTOCOL. What if I want to configure a UDP server-client, how should I do it?