-
Notifications
You must be signed in to change notification settings - Fork 455
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
UDP Send bug ... #220
Comments
UDP SERVER IP : 192.168.123.150 MAC:00:0E:7F:A8:C9:F1 TEST_CASE_1 : USE DHCP static byte mymac[] = {0x74,0x69,0x69,0x2D,0x30,0x31}; #define DM9051_DHCP //callback that prints received packets to the serial port { ether.sendUdp(msg, sizeof msg, 1337 , pc_ip, 1024); } void setup () { Serial.begin(57600); pinMode(9, OUTPUT); if (!ether.begin(sizeof Ethernet::buffer, mymac)) #ifdef DM9051_DHCP ether.printIp("IP Address:\t", ether.myip); ether.udpServerListenOnPort(&udpSerialPrint, 1337); } void loop() { ` com port output ` DHCP configuration done : DM9051_packetSend_42_: ` mac address is error :
|
TEST_CASE_2:USE staticSetup(myip) ` //#define DM9051_DHCP : #ifdef DM9051_DHCP com port output ` ` mac address is error :
|
TEST_CASE_3:USE staticSetup(myip, gwip, dnsip, netmask) ` //#define DM9051_DHCP : #ifdef DM9051_DHCP com port output nenet IOT Demo mac address is error (is GWIP OR DNSIP mac address):
|
TEST_CASE_4:USE staticSetup(myip, udp_serverip, udp_serverip, netmask) ` : #ifdef DM9051_DHCP com port output ` ` mac address is ok:
|
if the destination is on the local subnet the library must make an ARP request for the destination IP. One would have to add another state machine to implement this. Doing this properly with timeouts and error handling would be a considerable effort. A work-around is to send to the local subnet's broadcast address. |
#97
#181
I'm sorry, please forgive my broken English, I was using google translation!
I was doing UDP tests, we found a problem simply is not going to update ethercard sendudp () function, specify the UDP server ip mac address!
Cause is supposed to send UDP server packets, sent into the wrong mac address.
So my current solution is to use mode 3, the UDP server's ip settings in gwip, dnsip, so that you can on a normal pc received ethercard udp packets sent over it!
A recommendation can be added manually ipLookup function (similar dnslookup) to the user himself through this function to call to update arp hisip and its corresponding mac address in tcp / ip in!
Remarks:
You can view tcpip.cpp the EtherCard :: udpPrepare (), doing if (is_lan (myip, dip)) is judged, because UDP in LAN, it will execute setMACandIPs (destmacaddr, dip);
At this dip is udp server's ip, udp server but not destmacaddr mac address, will cause such an error occurs!
If users have ipLookup (), you can do this in some action before, to manually update the look destmacaddr to correct udp server mac address, such a mistake will not happen!
========= The following is a description of Chinese ========= 下面是中文的说明
抱歉请原谅我的破英文,我是使用 google 翻译的!
我在做 UDP 测试时,发现了一个问题,简单的说就是 ethercard 不会去更新 sendudp() 函数中,指定的 UDP server ip 的 mac 地址!
导致原本要发给 UDP server 的封包,变成发给了错误的 mac 地址。
3.使用 static ip ,使用 staticSetup(myip, gwip, dnsip, netmask) 时, mac 地址会变成 GWIP 或 DNSIP 的 mac 地址
所以我目前的解决方案是使用 3 的方式,把 UDP server 的 ip 设置在 gwip , dnsip ,这样就可以正常的在 pc 上接收到 ethercard 发送过来的 udp 封包了!
建议可以在 tcp/ip 中加一个手动 ipLookup 函数 (类似 dnslookup) 给使用者自已透过这一个函数,来调用 arp 去更新 hisip 和其对应的 mac 地址!
备注:
你可以查看 tcpip.cpp 中的 EtherCard::udpPrepare() , 在做 if(is_lan(myip,dip)) 判断时,因为 UDP 是在 LAN ,所以会执行 setMACandIPs(destmacaddr, dip);
此时 dip 是 udp server 的 ip ,但是 destmacaddr 并不是 udp server 的 mac 地址,才会导致这样的错误发生!
若是有 ipLookup() 时,就可以在做这一些动作前,手动去更新一下 destmacaddr 到正确的 udp server 的 mac 地址,就不会发生这样的错误了!
The text was updated successfully, but these errors were encountered: