Ethernet_sendUDP
Posted: 11 May 2009 10:37
It seems that I can respond to a UDP packet by returning the required packet length from Ethernet_UserUDP but I've not been able to send a UDP packet via Ethernet_sendUDP.
In the example it shows this;
dim
IpAddr as byte[4] ' remote IP address
...
IpAddr[0] = 192
IpAddr[0] = 168
IpAddr[0] = 1
IpAddr[0] = 1
...
Ethernet_sendUDP(IpAddr, 10001, 10001, "Hello", 5) ' send Hello message to the above IP address, from UDP port 10001 to UDP port 10001
The IpAddr[0] repeated four times is clearly an error and it should show [0],[1],[2].. but when I try to compile this example I get this;
160:48 E-27 Incompatible types ( to ?277) http_demo.pbas
As shown in the forum by BarryP I can get around the error by doing this;
destIP[0] = 192
destIP[1] = 168
destIP[2] = 1
destIP[3] = 104
udpData="Jerome is great"
sourcePort = 10001
destPort = 10001
pktLen = strlen(udpData)
Ethernet_sendUDP(destIP, sourcePort, destPort, pkt, pktLen)
But I then don't see any packets being sent?
Any ideas?
Thanks,
Jerome
In the example it shows this;
dim
IpAddr as byte[4] ' remote IP address
...
IpAddr[0] = 192
IpAddr[0] = 168
IpAddr[0] = 1
IpAddr[0] = 1
...
Ethernet_sendUDP(IpAddr, 10001, 10001, "Hello", 5) ' send Hello message to the above IP address, from UDP port 10001 to UDP port 10001
The IpAddr[0] repeated four times is clearly an error and it should show [0],[1],[2].. but when I try to compile this example I get this;
160:48 E-27 Incompatible types ( to ?277) http_demo.pbas
As shown in the forum by BarryP I can get around the error by doing this;
destIP[0] = 192
destIP[1] = 168
destIP[2] = 1
destIP[3] = 104
udpData="Jerome is great"
sourcePort = 10001
destPort = 10001
pktLen = strlen(udpData)
Ethernet_sendUDP(destIP, sourcePort, destPort, pkt, pktLen)
But I then don't see any packets being sent?
Any ideas?
Thanks,
Jerome