Hi,
I'm writing a simple UDP server. The server is receiving on port 8001
conn = netconn_new( NETCONN_UDP );
netconn_bind( conn, NULL, 8001 );
if ( buf = netconn_recv( conn ) )
{
netbuf_data( buf, (void *)&data, (void *)&len );
// Processing data
// Send reply message to the client!!!
}
How can I send reply message to the client?
I must to do the following transaction:
Request:
client_ip : client_port -> server_ip : 8001
Response:
server_ip : 8001 -> 255.255.255.255 : client_port
How can I obtain the client's port? I wrote the following code
netconn_connect( conn, &ip, PORT ); // PORT - fixed port number
previously defined
buf = netbuf_new();
netbuf_ref(buf, helloResponse, 46);
netconn_send(conn, buf);
netconn_disconnect(conn);
and it is working (i see packets in Wireshark), but only with fixed port
number. I was trying to use netconn_peer() function and
conn->pcb.udp->remote_port field with no effects.
Thanks for any advises,
Regards,
Gregory
--
View this message in context:
http://www.nabble.com/UDP-server---how-to-send-response-to-client%27s-port-tp21848389p21848389.html
Sent from the lwip-users mailing list archive at Nabble.com.
_______________________________________________
lwip-users mailing list
[email protected]
http://lists.nongnu.org/mailman/listinfo/lwip-users