[Question]
What is the purpose or scenario that remote ip and remote port should be set again before each calling of espconn_send()? If we use it only for one-to-one repeative UDP communication, is it still a must?
[Description]
The docuement "2c-esp8266-non-os-sdk-api-reference" says in the decription to the function of espconn_send(or espconn_sent) that, "If it is a UDP transmission, please set espconn->proto.udp->remote_ip and remote_port before every calling of espconn_send".
However,
Firstly, we debug by print to find that, if we set the remote_ip and remote_port once during initialization, the remote_ip and remote_port never get changed before each of repeative calling of this function. Even during the time, the sender receive another UDP packet from a third network node to the same local port, the remote_port and remote_ip are still unchanged. Therefore, the set of remote_ip and remote_port seems unnecessary. And our test seems to indicate that there is no failure if we don't set the remote_ip and remote_port each calling of espconn_sent when we do not change the target receiver.
So, what is the actual purpose or scenario of such a must? As you know, if we have to follow this must, we have to assign additional static variable to contain the remote_ip and remote_port, which are actually already in the variable of escconn, which might introduce space consuming or potential logic complexity, especially when we implement multi-link applications.
Secondly, as we know, the UDP is a peer-to-peer network arch(i.e. no server or client actually) so anytime the sender could change the remote_ip and remote_port freely if he expect to change the target receiver and then send. that is, we "could" set remote_ip and remote_port before every calling of espconn_send, but it is not a "must" mandatory.
Be there any mistake or missing , please kindly point them out.
Thanks in advance!
YimingStatistics: Posted by Guest — Fri Jun 09, 2017 11:01 am
]]>