ESP8266 Developer Zone The Official ESP8266 Forum 2017-06-13T13:23:18+08:00 https://bbs.espressif.com:443/feed.php?f=7&t=5012 2017-06-13T13:23:18+08:00 2017-06-13T13:23:18+08:00 https://bbs.espressif.com:443/viewtopic.php?t=5012&p=13922#p13922 <![CDATA[Re: what is the purpose or scenario that remote ip and port should be set again before each calling of espconn_send?]]>
Hope it would be useful.

Actually, whether to use espconn_send/espconn_sent or espconn_sendto() makes no difference for the original question of this thread. That is, you would get the same scenario result to the original question.

Then, what is the answer of the original question of this thread ?

Statistics: Posted by Guest — Tue Jun 13, 2017 1:23 pm


]]>
2017-06-11T21:00:38+08:00 2017-06-11T21:00:38+08:00 https://bbs.espressif.com:443/viewtopic.php?t=5012&p=13881#p13881 <![CDATA[Re: what is the purpose or scenario that remote ip and port should be set again before each calling of espconn_send?]]> Statistics: Posted by Her Mary — Sun Jun 11, 2017 9:00 pm


]]>
2017-06-09T11:01:07+08:00 2017-06-09T11:01:07+08:00 https://bbs.espressif.com:443/viewtopic.php?t=5012&p=13821#p13821 <![CDATA[what is the purpose or scenario that remote ip and port should be set again before each calling of espconn_send?]]>
[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!

Yiming

Statistics: Posted by Guest — Fri Jun 09, 2017 11:01 am


]]>