How to get remote client's IP and port number for UDP broadcasting?

ftdiyun
Posts: 25
Joined: Tue Jul 19, 2016 5:32 pm

How to get remote client's IP and port number for UDP broadcasting?

Postby ftdiyun » Wed Aug 10, 2016 10:14 am

Gor UDP broadcasting, how should we know where is the message received from? To implement recvfrom function, we need to know the client's IP address and port number. Can you suggest which API in the SDK can be used? Thanks.

pratik

Re: How to get remote client's IP and port number for UDP broadcasting?

Postby pratik » Wed Aug 10, 2016 10:33 am

Hello,

In the receive callback function, arg points to the corresponding espconn structure, so you should be able to access the connection related information from the structure when executing a receive callback and thus determine what action to take:
void espconn_recv_callback ( void *arg, char *pdata, unsigned short len )

Who is online

Users browsing this forum: No registered users and 189 guests