Ethernet_sendUDP

General discussion on mikroBasic.
Post Reply
Author
Message
joswaldjones
Posts: 9
Joined: 17 Dec 2008 14:17

Ethernet_sendUDP

#1 Post by joswaldjones » 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

joswaldjones
Posts: 9
Joined: 17 Dec 2008 14:17

#2 Post by joswaldjones » 11 May 2009 14:09

oops, change 'Ethernet_sendUDP(destIP, sourcePort, destPort, pkt, pktLen)' to Ethernet_sendUDP(destIP, sourcePort, destPort, @udpData, pktLen)

Thanks

joswaldjones
Posts: 9
Joined: 17 Dec 2008 14:17

FIXED

#3 Post by joswaldjones » 11 May 2009 15:49

Please disregard.

Problem solved.

aparna k
Posts: 55
Joined: 17 Jul 2019 07:17

Re: Ethernet_sendUDP

#4 Post by aparna k » 03 Dec 2020 18:49

Hi,

When i am using Ethernet_sendUDP function, data is not sending to the corresponding IP address and at that time, ping is not coming.
Please anyone guide me to solve this issue?
I am using IP address as 10.0.0.50 (10 series) not 192.168.1.124 (192 series). And i am testing the data in Hercules.

Please help me to solve this issue.

Thanks in Advance.

aparna k
Posts: 55
Joined: 17 Jul 2019 07:17

Re: Ethernet_sendUDP

#5 Post by aparna k » 16 Dec 2020 06:00

Hello,
can anyone share the code in which EThernet_SendUDP function will work?

Thomas.Pahl@t-online.de
Posts: 158
Joined: 24 May 2008 15:55
Location: Germany

Re: Ethernet_sendUDP

#6 Post by Thomas.Pahl@t-online.de » 16 Dec 2020 12:02

Hi, perhaps you have no Ethernet_userTimerSec variable that your program has to increment every second? Look at help for the library under: "Important"

Post Reply

Return to “mikroBasic General”