The demo HTTP_Demo (Net_Wireless_MCW1001 demo for MCW1001 module) is running correctly on my site after a http://wifi_ip_adresse in a browser .
I modified the HTTP_Demo (Net_Wireless_MCW1001 demo for MCW1001 module) to manage only Request UDP server
3 change in RunHttpServer to move "TCP port 80" to "UDP port 10001"
Code: Select all
void RunHttpServer() {
Lcd_Cmd(_LCD_CLEAR);
Lcd_Out(1,1,txt8);
Lcd_Out(2,1,txt9);
rfIconMark = 3;
DrawRfIcon();
while(1) {
socketHandle = 0;
backLog = 1;
//localPort = 80; [color=#BF0000]modif 1[/color]
localPort = 10001;
////////////////////////////////
//Net_Wireless_MCW1001_SocketCreate(&socketHandle, _NET_WIRELESS_MCW1001_SOCKET_TYPE_TCP); // Create TCP socket [color=#BF0000]Modif 2[/color]
Net_Wireless_MCW1001_SocketCreate(&socketHandle, _NET_WIRELESS_MCW1001_SOCKET_TYPE_UDP); // become UDP socket
///////////////////////////////////////////////////////////////////////////
Net_Wireless_MCW1001_SocketBind(socketHandle, &localPort, &bindResponse); // Bind socket to the listen port
Net_Wireless_MCW1001_TCP_Listen(socketHandle, &backLog, &listenResponse); // Prepare the socket to listen for connection
// with one children socket.
while(1) {
socketChild = socketHandle;
Net_Wireless_MCW1001_TCP_Accept(&socketChild, &remotePort, remoteIpAdd); // Accept incoming conncetion
if (socketChild != 254) { // Accept function set socketChild.
break;
}
}
//[color=#BF0000]Modif 3[/color]
Lcd_Out(2,1,"should Detect UDP_HERE socketChild !=254 but nothing ? ");
Delay_ms(2000);
////////////////////////////////////////////////////
//SendHttpResponse();
Net_Wireless_MCW1001_SocketClose(socketChild); // Close sockets
Net_Wireless_MCW1001_SocketClose(socketHandle);
}
}
Have you any Idea ..... OK with TCP port 80 but not with UDP port 10001
I used mikroc Pro for Pic 5.61 with PIC18F45K22 + WiFi PLUS Click Board
best regards
Herve