Discussion:
Using UDP?
Jim Wagner
2017-04-21 22:06:16 UTC
Permalink
Greetings NUG -

I have an application where I have a device connected to the host via an ethernet cable. No switchers, routers, hubs, etc. Just plain direct cross-over cable.

This device broadcasts its ip address (and other information) via UDP on port 13000. EasyUDPSocket seems to be an appropriate tool to use, but I am greatly confused. The documentation says that it has no DataAvailable event - how are you supposed to access received data. The documentation only seems to talk about sending! It is also not clear how to add an EasyUDPSocket to the project. I add a generic object and EasyUDPSocket is not an option. I can add a UDPSocket and EasyUDPSocket is an option but it seems to want to give me “AutoDiscovery”. A bit of help would really be appreciated.

Also, can anyone provide some hints about how to manage the host’s firewall so that UDP packets can be received?

Many thanks
Jim

James Wagner
Oregon Research Electronics
http://www.orelectronics.net <http://www.orelectronics.net/>




_______________________________________________

Xojo forum:

https:/
vaughnsc .
2017-04-21 22:44:31 UTC
Permalink
Hi Jim

Haven't tussled with UDP sockets but, as a subclass, isn't it possible that
it isn't documented because it's implied by its superclass? In other words,
add one and see if the event is available.

As for "autodiscovery" by which I understand Bonjour/ZeroConf, what's
keeping you from ignoring/disabling it?


On Apr 21, 2017 6:07 PM, "Jim Wagner" <***@comcast.net> wrote:

Greetings NUG -

I have an application where I have a device connected to the host via an
ethernet cable. No switchers, routers, hubs, etc. Just plain direct
cross-over cable.

This device broadcasts its ip address (and other information) via UDP on
port 13000. EasyUDPSocket seems to be an appropriate tool to use, but I am
greatly confused. The documentation says that it has no DataAvailable event
- how are you supposed to access received data. The documentation only
seems to talk about sending! It is also not clear how to add an
EasyUDPSocket to the project. I add a generic object and EasyUDPSocket is
not an option. I can add a UDPSocket and EasyUDPSocket is an option but it
seems to want to give me “AutoDiscovery”. A bit of help would really be
appreciated.

Also, can anyone provide some hints about how to manage the host’s firewall
so that UDP packets can be received?

Many thanks
Jim

James Wagner
Oregon Research Electronics
http://www.orelectronics.net <http://www.orelectronics.net/>




_______________________________________________

Xojo forum:

https://forum.xojo.com/
_______________________________________________

Xoj
Jon Ogden
2017-04-21 23:30:15 UTC
Permalink
I use the regular UDP class. Works well.

There certainly is a DataAvailable event! EasyUDP does too. I think you are confused!

What you don't have is any guarantee that you communication will go through.

Going through firewalls for UDP is tricky. It can be done but you have to specifically set it up so that it will pass UDP packets. Generally UDP is mainly a LAN based protocol probably mainly due to the fact that the receiving devices are not guaranteed to receive a transmission like they are with TCP/IP.

Sent from my iPhone
Post by Jim Wagner
Greetings NUG -
I have an application where I have a device connected to the host via an ethernet cable. No switchers, routers, hubs, etc. Just plain direct cross-over cable.
This device broadcasts its ip address (and other information) via UDP on port 13000. EasyUDPSocket seems to be an appropriate tool to use, but I am greatly confused. The documentation says that it has no DataAvailable event - how are you supposed to access received data. The documentation only seems to talk about sending! It is also not clear how to add an EasyUDPSocket to the project. I add a generic object and EasyUDPSocket is not an option. I can add a UDPSocket and EasyUDPSocket is an option but it seems to want to give me “AutoDiscovery”. A bit of help would really be appreciated.
Also, can anyone provide some hints about how to manage the host’s firewall so that UDP packets can be received?
Many thanks
Jim
James Wagner
Oregon Research Electronics
http://www.orelectronics.net <http://www.orelectronics.net/>
_______________________________________________
https://forum.xojo.com/
_______________________________________________

Xojo forum:
Jim Wagner
2017-04-22 03:32:22 UTC
Permalink
Thanks, Jon -

The documentation for the EasyUDPSocket class says:

The DataAvailable event of the UDPSocket <file:///index.php/UDPSocket> class is not available.

Likewise, it says

Even though you have access to the Write and Read methods of the UDPSocket <file:///index.php/UDPSocket> class, you should never call them. Doing so will cause a RuntimeException <file:///index.php/RuntimeException> to be raised (with an appropriate message set). This is so the internal protocol is enforced

So, if you can’t read, how do you get to the data?

Jim

James Wagner
Oregon Research Electronics
http://www.orelectronics.net <http://www.orelectronics.net/>
Post by Jon Ogden
I use the regular UDP class. Works well.
There certainly is a DataAvailable event! EasyUDP does too. I think you are confused!
What you don't have is any guarantee that you communication will go through.
Going through firewalls for UDP is tricky. It can be done but you have to specifically set it up so that it will pass UDP packets. Generally UDP is mainly a LAN based protocol probably mainly due to the fact that the receiving devices are not guaranteed to receive a transmission like they are with TCP/IP.
Sent from my iPhone
Post by Jim Wagner
Greetings NUG -
I have an application where I have a device connected to the host via an ethernet cable. No switchers, routers, hubs, etc. Just plain direct cross-over cable.
This device broadcasts its ip address (and other information) via UDP on port 13000. EasyUDPSocket seems to be an appropriate tool to use, but I am greatly confused. The documentation says that it has no DataAvailable event - how are you supposed to access received data. The documentation only seems to talk about sending! It is also not clear how to add an EasyUDPSocket to the project. I add a generic object and EasyUDPSocket is not an option. I can add a UDPSocket and EasyUDPSocket is an option but it seems to want to give me “AutoDiscovery”. A bit of help would really be appreciated.
Also, can anyone provide some hints about how to manage the host’s firewall so that UDP packets can be received?
Many thanks
Jim
James Wagner
Oregon Research Electronics
http://www.orelectronics.net <http://www.orelectronics.net/>
_______________________________________________
https://forum.xojo.com/
_______________________________________________
https://forum.xojo.com/
_____________________________________________
Jon Ogden
2017-04-22 03:53:51 UTC
Permalink
Well, first of all, Jim, I don’t use the EasyUDPSocket just for reasons like that. The Xojo EasyUDPSocket class probably raises an event when the data comes in and gives it to you. In fact, yes it does, that’s the “ReceivedMessage” event. So they give you that, you don’t have to use the other events. The DataAvailable event is probably not accessible. EasyUDPSocket is subclassed from UDPSocket. Xojo uses the UDPSocket.DataAvailable event, reads the Datagram and then formats it into a nice string, IP address, etc and then raises the ReceivedMessage event.

In the straight UDPSocket method you have access to all those items. But Read gives you a Datagram. A Datagram is an object that has the data that was sent, the IP address of the sender and the UDP port information.

Jon
Post by Jim Wagner
Thanks, Jon -
The DataAvailable event of the UDPSocket <file:///index.php/UDPSocket> class is not available.
Likewise, it says
Even though you have access to the Write and Read methods of the UDPSocket <file:///index.php/UDPSocket> class, you should never call them. Doing so will cause a RuntimeException <file:///index.php/RuntimeException> to be raised (with an appropriate message set). This is so the internal protocol is enforced
So, if you can’t read, how do you get to the data?
Jim
James Wagner
Oregon Research Electronics
http://www.orelectronics.net <http://www.orelectronics.net/>
Post by Jon Ogden
I use the regular UDP class. Works well.
There certainly is a DataAvailable event! EasyUDP does too. I think you are confused!
What you don't have is any guarantee that you communication will go through.
Going through firewalls for UDP is tricky. It can be done but you have to specifically set it up so that it will pass UDP packets. Generally UDP is mainly a LAN based protocol probably mainly due to the fact that the receiving devices are not guaranteed to receive a transmission like they are with TCP/IP.
Sent from my iPhone
Post by Jim Wagner
Greetings NUG -
I have an application where I have a device connected to the host via an ethernet cable. No switchers, routers, hubs, etc. Just plain direct cross-over cable.
This device broadcasts its ip address (and other information) via UDP on port 13000. EasyUDPSocket seems to be an appropriate tool to use, but I am greatly confused. The documentation says that it has no DataAvailable event - how are you supposed to access received data. The documentation only seems to talk about sending! It is also not clear how to add an EasyUDPSocket to the project. I add a generic object and EasyUDPSocket is not an option. I can add a UDPSocket and EasyUDPSocket is an option but it seems to want to give me “AutoDiscovery”. A bit of help would really be appreciated.
Also, can anyone provide some hints about how to manage the host’s firewall so that UDP packets can be received?
Many thanks
Jim
James Wagner
Oregon Research Electronics
http://www.orelectronics.net <http://www.orelectronics.net/>
_______________________________________________
https://forum.xojo.com/
_______________________________________________
https://forum.xojo.com/
_______________________________________________
https://forum.xojo.com/
_______________________________________________

Xojo forum:
Jim Wagner
2017-04-22 04:03:45 UTC
Permalink
Missed that other event. Thanks for catching that.

Will just have to give it a try.

Any recommendations on host firewall?

Jim

James Wagner
Oregon Research Electronics
http://www.orelectronics.net <http://www.orelectronics.net/>
Post by Jon Ogden
Well, first of all, Jim, I don’t use the EasyUDPSocket just for reasons like that. The Xojo EasyUDPSocket class probably raises an event when the data comes in and gives it to you. In fact, yes it does, that’s the “ReceivedMessage” event. So they give you that, you don’t have to use the other events. The DataAvailable event is probably not accessible. EasyUDPSocket is subclassed from UDPSocket. Xojo uses the UDPSocket.DataAvailable event, reads the Datagram and then formats it into a nice string, IP address, etc and then raises the ReceivedMessage event.
In the straight UDPSocket method you have access to all those items. But Read gives you a Datagram. A Datagram is an object that has the data that was sent, the IP address of the sender and the UDP port information.
Jon
Post by Jim Wagner
Thanks, Jon -
The DataAvailable event of the UDPSocket <file:///index.php/UDPSocket> class is not available.
Likewise, it says
Even though you have access to the Write and Read methods of the UDPSocket <file:///index.php/UDPSocket> class, you should never call them. Doing so will cause a RuntimeException <file:///index.php/RuntimeException> to be raised (with an appropriate message set). This is so the internal protocol is enforced
So, if you can’t read, how do you get to the data?
Jim
James Wagner
Oregon Research Electronics
http://www.orelectronics.net <http://www.orelectronics.net/>
Post by Jon Ogden
I use the regular UDP class. Works well.
There certainly is a DataAvailable event! EasyUDP does too. I think you are confused!
What you don't have is any guarantee that you communication will go through.
Going through firewalls for UDP is tricky. It can be done but you have to specifically set it up so that it will pass UDP packets. Generally UDP is mainly a LAN based protocol probably mainly due to the fact that the receiving devices are not guaranteed to receive a transmission like they are with TCP/IP.
Sent from my iPhone
Post by Jim Wagner
Greetings NUG -
I have an application where I have a device connected to the host via an ethernet cable. No switchers, routers, hubs, etc. Just plain direct cross-over cable.
This device broadcasts its ip address (and other information) via UDP on port 13000. EasyUDPSocket seems to be an appropriate tool to use, but I am greatly confused. The documentation says that it has no DataAvailable event - how are you supposed to access received data. The documentation only seems to talk about sending! It is also not clear how to add an EasyUDPSocket to the project. I add a generic object and EasyUDPSocket is not an option. I can add a UDPSocket and EasyUDPSocket is an option but it seems to want to give me “AutoDiscovery”. A bit of help would really be appreciated.
Also, can anyone provide some hints about how to manage the host’s firewall so that UDP packets can be received?
Many thanks
Jim
James Wagner
Oregon Research Electronics
http://www.orelectronics.net <http://www.orelectronics.net/>
_______________________________________________
https://forum.xojo.com/
_______________________________________________
https://forum.xojo.com/
_______________________________________________
https://forum.xojo.com/
_______________________________________________
https://forum.xojo.com/
_______________________________________________

Xojo forum:

https://forum.xojo.com
Jim Wagner
2017-04-22 04:51:31 UTC
Permalink
An additional question:

The ReceivedMessage() event requires a parameter FromIP as string. What do I do if I do not know the sender’s IP address? I want to receive messages from any UDP device in the network and since that “network” is a direct ethernet cable with no hubs, switches, or routers, there won’t be any confusion from multiple senders. All that I know, a-priori, is that it is coming from port 13000.

Any suggestions? Do “wild-card” symbols work in ip addresses? Something like “*.*.*.*:1300”?

Jim

James Wagner
Oregon Research Electronics
http://www.orelectronics.net <http://www.orelectronics.net/>
Post by Jim Wagner
Missed that other event. Thanks for catching that.
Will just have to give it a try.
Any recommendations on host firewall?
Jim
James Wagner
Oregon Research Electronics
http://www.orelectronics.net <http://www.orelectronics.net/>
Post by Jon Ogden
Well, first of all, Jim, I don’t use the EasyUDPSocket just for reasons like that. The Xojo EasyUDPSocket class probably raises an event when the data comes in and gives it to you. In fact, yes it does, that’s the “ReceivedMessage” event. So they give you that, you don’t have to use the other events. The DataAvailable event is probably not accessible. EasyUDPSocket is subclassed from UDPSocket. Xojo uses the UDPSocket.DataAvailable event, reads the Datagram and then formats it into a nice string, IP address, etc and then raises the ReceivedMessage event.
In the straight UDPSocket method you have access to all those items. But Read gives you a Datagram. A Datagram is an object that has the data that was sent, the IP address of the sender and the UDP port information.
Jon
Post by Jim Wagner
Thanks, Jon -
The DataAvailable event of the UDPSocket <file:///index.php/UDPSocket> class is not available.
Likewise, it says
Even though you have access to the Write and Read methods of the UDPSocket <file:///index.php/UDPSocket> class, you should never call them. Doing so will cause a RuntimeException <file:///index.php/RuntimeException> to be raised (with an appropriate message set). This is so the internal protocol is enforced
So, if you can’t read, how do you get to the data?
Jim
James Wagner
Oregon Research Electronics
http://www.orelectronics.net <http://www.orelectronics.net/>
Post by Jon Ogden
I use the regular UDP class. Works well.
There certainly is a DataAvailable event! EasyUDP does too. I think you are confused!
What you don't have is any guarantee that you communication will go through.
Going through firewalls for UDP is tricky. It can be done but you have to specifically set it up so that it will pass UDP packets. Generally UDP is mainly a LAN based protocol probably mainly due to the fact that the receiving devices are not guaranteed to receive a transmission like they are with TCP/IP.
Sent from my iPhone
Post by Jim Wagner
Greetings NUG -
I have an application where I have a device connected to the host via an ethernet cable. No switchers, routers, hubs, etc. Just plain direct cross-over cable.
This device broadcasts its ip address (and other information) via UDP on port 13000. EasyUDPSocket seems to be an appropriate tool to use, but I am greatly confused. The documentation says that it has no DataAvailable event - how are you supposed to access received data. The documentation only seems to talk about sending! It is also not clear how to add an EasyUDPSocket to the project. I add a generic object and EasyUDPSocket is not an option. I can add a UDPSocket and EasyUDPSocket is an option but it seems to want to give me “AutoDiscovery”. A bit of help would really be appreciated.
Also, can anyone provide some hints about how to manage the host’s firewall so that UDP packets can be received?
Many thanks
Jim
James Wagner
Oregon Research Electronics
http://www.orelectronics.net <http://www.orelectronics.net/>
_______________________________________________
https://forum.xojo.com/
_______________________________________________
https://forum.xojo.com/
_______________________________________________
https://forum.xojo.com/
_______________________________________________
https://forum.xojo.com/
_______________________________________________
https://forum.xojo.com/
_______________________________________________

Xojo forum:

htt
Jon Ogden
2017-04-22 05:05:40 UTC
Permalink
Jim,

You don't send any parameters to the event when it is called. You don't do that with any event raised by the framework! The IP address is contained in the UDP Datagram. The EasyUDP protocol takes and splits out the received data and the received IP address and gives them to you so you can access them in the event.

Jon

Sent from my iPhone
Post by Jim Wagner
The ReceivedMessage() event requires a parameter FromIP as string. What do I do if I do not know the sender’s IP address? I want to receive messages from any UDP device in the network and since that “network” is a direct ethernet cable with no hubs, switches, or routers, there won’t be any confusion from multiple senders. All that I know, a-priori, is that it is coming from port 13000.
Any suggestions? Do “wild-card” symbols work in ip addresses? Something like “*.*.*.*:1300”?
Jim
James Wagner
Oregon Research Electronics
http://www.orelectronics.net <http://www.orelectronics.net/>
Post by Jim Wagner
Missed that other event. Thanks for catching that.
Will just have to give it a try.
Any recommendations on host firewall?
Jim
James Wagner
Oregon Research Electronics
http://www.orelectronics.net <http://www.orelectronics.net/>
Post by Jon Ogden
Well, first of all, Jim, I don’t use the EasyUDPSocket just for reasons like that. The Xojo EasyUDPSocket class probably raises an event when the data comes in and gives it to you. In fact, yes it does, that’s the “ReceivedMessage” event. So they give you that, you don’t have to use the other events. The DataAvailable event is probably not accessible. EasyUDPSocket is subclassed from UDPSocket. Xojo uses the UDPSocket.DataAvailable event, reads the Datagram and then formats it into a nice string, IP address, etc and then raises the ReceivedMessage event.
In the straight UDPSocket method you have access to all those items. But Read gives you a Datagram. A Datagram is an object that has the data that was sent, the IP address of the sender and the UDP port information.
Jon
Post by Jim Wagner
Thanks, Jon -
The DataAvailable event of the UDPSocket <file:///index.php/UDPSocket> class is not available.
Likewise, it says
Even though you have access to the Write and Read methods of the UDPSocket <file:///index.php/UDPSocket> class, you should never call them. Doing so will cause a RuntimeException <file:///index.php/RuntimeException> to be raised (with an appropriate message set). This is so the internal protocol is enforced
So, if you can’t read, how do you get to the data?
Jim
James Wagner
Oregon Research Electronics
http://www.orelectronics.net <http://www.orelectronics.net/>
Post by Jon Ogden
I use the regular UDP class. Works well.
There certainly is a DataAvailable event! EasyUDP does too. I think you are confused!
What you don't have is any guarantee that you communication will go through.
Going through firewalls for UDP is tricky. It can be done but you have to specifically set it up so that it will pass UDP packets. Generally UDP is mainly a LAN based protocol probably mainly due to the fact that the receiving devices are not guaranteed to receive a transmission like they are with TCP/IP.
Sent from my iPhone
Post by Jim Wagner
Greetings NUG -
I have an application where I have a device connected to the host via an ethernet cable. No switchers, routers, hubs, etc. Just plain direct cross-over cable.
This device broadcasts its ip address (and other information) via UDP on port 13000. EasyUDPSocket seems to be an appropriate tool to use, but I am greatly confused. The documentation says that it has no DataAvailable event - how are you supposed to access received data. The documentation only seems to talk about sending! It is also not clear how to add an EasyUDPSocket to the project. I add a generic object and EasyUDPSocket is not an option. I can add a UDPSocket and EasyUDPSocket is an option but it seems to want to give me “AutoDiscovery”. A bit of help would really be appreciated.
Also, can anyone provide some hints about how to manage the host’s firewall so that UDP packets can be received?
Many thanks
Jim
James Wagner
Oregon Research Electronics
http://www.orelectronics.net <http://www.orelectronics.net/>
_______________________________________________
https://forum.xojo.com/
_______________________________________________
https://forum.xojo.com/
_______________________________________________
https://forum.xojo.com/
_______________________________________________
https://forum.xojo.com/
_______________________________________________
https://forum.xojo.com/
_______________________________________________
https://forum.xojo.com/
_______________________________________________

Xojo forum:

https://forum.xojo.c
Jim Wagner
2017-04-22 05:11:29 UTC
Permalink
Ahh, thanks.

Appreciate your help!

Jim

James Wagner
Oregon Research Electronics
http://www.orelectronics.net <http://www.orelectronics.net/>
Post by Jon Ogden
Jim,
You don't send any parameters to the event when it is called. You don't do that with any event raised by the framework! The IP address is contained in the UDP Datagram. The EasyUDP protocol takes and splits out the received data and the received IP address and gives them to you so you can access them in the event.
Jon
Sent from my iPhone
Post by Jim Wagner
The ReceivedMessage() event requires a parameter FromIP as string. What do I do if I do not know the sender’s IP address? I want to receive messages from any UDP device in the network and since that “network” is a direct ethernet cable with no hubs, switches, or routers, there won’t be any confusion from multiple senders. All that I know, a-priori, is that it is coming from port 13000.
Any suggestions? Do “wild-card” symbols work in ip addresses? Something like “*.*.*.*:1300”?
Jim
James Wagner
Oregon Research Electronics
http://www.orelectronics.net <http://www.orelectronics.net/>
Post by Jim Wagner
Missed that other event. Thanks for catching that.
Will just have to give it a try.
Any recommendations on host firewall?
Jim
James Wagner
Oregon Research Electronics
http://www.orelectronics.net <http://www.orelectronics.net/>
Post by Jon Ogden
Well, first of all, Jim, I don’t use the EasyUDPSocket just for reasons like that. The Xojo EasyUDPSocket class probably raises an event when the data comes in and gives it to you. In fact, yes it does, that’s the “ReceivedMessage” event. So they give you that, you don’t have to use the other events. The DataAvailable event is probably not accessible. EasyUDPSocket is subclassed from UDPSocket. Xojo uses the UDPSocket.DataAvailable event, reads the Datagram and then formats it into a nice string, IP address, etc and then raises the ReceivedMessage event.
In the straight UDPSocket method you have access to all those items. But Read gives you a Datagram. A Datagram is an object that has the data that was sent, the IP address of the sender and the UDP port information.
Jon
Post by Jim Wagner
Thanks, Jon -
The DataAvailable event of the UDPSocket <file:///index.php/UDPSocket> class is not available.
Likewise, it says
Even though you have access to the Write and Read methods of the UDPSocket <file:///index.php/UDPSocket> class, you should never call them. Doing so will cause a RuntimeException <file:///index.php/RuntimeException> to be raised (with an appropriate message set). This is so the internal protocol is enforced
So, if you can’t read, how do you get to the data?
Jim
James Wagner
Oregon Research Electronics
http://www.orelectronics.net <http://www.orelectronics.net/>
Post by Jon Ogden
I use the regular UDP class. Works well.
There certainly is a DataAvailable event! EasyUDP does too. I think you are confused!
What you don't have is any guarantee that you communication will go through.
Going through firewalls for UDP is tricky. It can be done but you have to specifically set it up so that it will pass UDP packets. Generally UDP is mainly a LAN based protocol probably mainly due to the fact that the receiving devices are not guaranteed to receive a transmission like they are with TCP/IP.
Sent from my iPhone
Post by Jim Wagner
Greetings NUG -
I have an application where I have a device connected to the host via an ethernet cable. No switchers, routers, hubs, etc. Just plain direct cross-over cable.
This device broadcasts its ip address (and other information) via UDP on port 13000. EasyUDPSocket seems to be an appropriate tool to use, but I am greatly confused. The documentation says that it has no DataAvailable event - how are you supposed to access received data. The documentation only seems to talk about sending! It is also not clear how to add an EasyUDPSocket to the project. I add a generic object and EasyUDPSocket is not an option. I can add a UDPSocket and EasyUDPSocket is an option but it seems to want to give me “AutoDiscovery”. A bit of help would really be appreciated.
Also, can anyone provide some hints about how to manage the host’s firewall so that UDP packets can be received?
Many thanks
Jim
James Wagner
Oregon Research Electronics
http://www.orelectronics.net <http://www.orelectronics.net/>
_______________________________________________
https://forum.xojo.com/
_______________________________________________
https://forum.xojo.com/
_______________________________________________
https://forum.xojo.com/
_______________________________________________
https://forum.xojo.com/
_______________________________________________
https://forum.xojo.com/
_______________________________________________
https://forum.xojo.com/
_______________________________________________
https://forum.xojo.com/
_______________________________________________

Xojo forum:

https://for
Joe Huber
2017-04-22 14:09:02 UTC
Permalink
Jim
What destination IP address is the originator using when it sends the UDP message? Broadcast, multicast or unicast? Do you control that or is it fixed?
Post by Jim Wagner
Ahh, thanks.
Appreciate your help!
Jim
James Wagner
Oregon Research Electronics
http://www.orelectronics.net <http://www.orelectronics.net/>
Post by Jon Ogden
Jim,
You don't send any parameters to the event when it is called. You don't do that with any event raised by the framework! The IP address is contained in the UDP Datagram. The EasyUDP protocol takes and splits out the received data and the received IP address and gives them to you so you can access them in the event.
Jon
Sent from my iPhone
Post by Jim Wagner
The ReceivedMessage() event requires a parameter FromIP as string. What do I do if I do not know the sender’s IP address? I want to receive messages from any UDP device in the network and since that “network” is a direct ethernet cable with no hubs, switches, or routers, there won’t be any confusion from multiple senders. All that I know, a-priori, is that it is coming from port 13000.
Any suggestions? Do “wild-card” symbols work in ip addresses? Something like “*.*.*.*:1300”?
Jim
James Wagner
Oregon Research Electronics
http://www.orelectronics.net <http://www.orelectronics.net/>
Post by Jim Wagner
Missed that other event. Thanks for catching that.
Will just have to give it a try.
Any recommendations on host firewall?
Jim
James Wagner
Oregon Research Electronics
http://www.orelectronics.net <http://www.orelectronics.net/>
Post by Jon Ogden
Well, first of all, Jim, I don’t use the EasyUDPSocket just for reasons like that. The Xojo EasyUDPSocket class probably raises an event when the data comes in and gives it to you. In fact, yes it does, that’s the “ReceivedMessage” event. So they give you that, you don’t have to use the other events. The DataAvailable event is probably not accessible. EasyUDPSocket is subclassed from UDPSocket. Xojo uses the UDPSocket.DataAvailable event, reads the Datagram and then formats it into a nice string, IP address, etc and then raises the ReceivedMessage event.
In the straight UDPSocket method you have access to all those items. But Read gives you a Datagram. A Datagram is an object that has the data that was sent, the IP address of the sender and the UDP port information.
Jon
Post by Jim Wagner
Thanks, Jon -
The DataAvailable event of the UDPSocket <file:///index.php/UDPSocket> class is not available.
Likewise, it says
Even though you have access to the Write and Read methods of the UDPSocket <file:///index.php/UDPSocket> class, you should never call them. Doing so will cause a RuntimeException <file:///index.php/RuntimeException> to be raised (with an appropriate message set). This is so the internal protocol is enforced
So, if you can’t read, how do you get to the data?
Jim
James Wagner
Oregon Research Electronics
http://www.orelectronics.net <http://www.orelectronics.net/>
Post by Jon Ogden
I use the regular UDP class. Works well.
There certainly is a DataAvailable event! EasyUDP does too. I think you are confused!
What you don't have is any guarantee that you communication will go through.
Going through firewalls for UDP is tricky. It can be done but you have to specifically set it up so that it will pass UDP packets. Generally UDP is mainly a LAN based protocol probably mainly due to the fact that the receiving devices are not guaranteed to receive a transmission like they are with TCP/IP.
Sent from my iPhone
Post by Jim Wagner
Greetings NUG -
I have an application where I have a device connected to the host via an ethernet cable. No switchers, routers, hubs, etc. Just plain direct cross-over cable.
This device broadcasts its ip address (and other information) via UDP on port 13000. EasyUDPSocket seems to be an appropriate tool to use, but I am greatly confused. The documentation says that it has no DataAvailable event - how are you supposed to access received data. The documentation only seems to talk about sending! It is also not clear how to add an EasyUDPSocket to the project. I add a generic object and EasyUDPSocket is not an option. I can add a UDPSocket and EasyUDPSocket is an option but it seems to want to give me “AutoDiscovery”. A bit of help would really be appreciated.
Also, can anyone provide some hints about how to manage the host’s firewall so that UDP packets can be received?
Many thanks
Jim
James Wagner
Oregon Research Electronics
http://www.orelectronics.net <http://www.orelectronics.net/>
_______________________________________________
https://forum.xojo.com/
_______________________________________________
https://forum.xojo.com/
_______________________________________________
https://forum.xojo.com/
_______________________________________________
https://forum.xojo.com/
_______________________________________________
https://forum.xojo.com/
_______________________________________________
https://forum.xojo.com/
_______________________________________________
https://forum.xojo.com/
_______________________________________________
https://forum.xojo.com/
_______________________________________________

Xojo forum:

https://forum.
Jim Wagner
2017-04-22 14:45:42 UTC
Permalink
It is fixed and unknown at this point. Will have my hands on hardware in about a week.

Jim

James Wagner
Oregon Research Electronics
http://www.orelectronics.net <http://www.orelectronics.net/>
Post by Joe Huber
Jim
What destination IP address is the originator using when it sends the UDP message? Broadcast, multicast or unicast? Do you control that or is it fixed?
Post by Jim Wagner
Ahh, thanks.
Appreciate your help!
Jim
James Wagner
Oregon Research Electronics
http://www.orelectronics.net <http://www.orelectronics.net/>
Post by Jon Ogden
Jim,
You don't send any parameters to the event when it is called. You don't do that with any event raised by the framework! The IP address is contained in the UDP Datagram. The EasyUDP protocol takes and splits out the received data and the received IP address and gives them to you so you can access them in the event.
Jon
Sent from my iPhone
Post by Jim Wagner
The ReceivedMessage() event requires a parameter FromIP as string. What do I do if I do not know the sender’s IP address? I want to receive messages from any UDP device in the network and since that “network” is a direct ethernet cable with no hubs, switches, or routers, there won’t be any confusion from multiple senders. All that I know, a-priori, is that it is coming from port 13000.
Any suggestions? Do “wild-card” symbols work in ip addresses? Something like “*.*.*.*:1300”?
Jim
James Wagner
Oregon Research Electronics
http://www.orelectronics.net <http://www.orelectronics.net/>
Post by Jim Wagner
Missed that other event. Thanks for catching that.
Will just have to give it a try.
Any recommendations on host firewall?
Jim
James Wagner
Oregon Research Electronics
http://www.orelectronics.net <http://www.orelectronics.net/>
Post by Jon Ogden
Well, first of all, Jim, I don’t use the EasyUDPSocket just for reasons like that. The Xojo EasyUDPSocket class probably raises an event when the data comes in and gives it to you. In fact, yes it does, that’s the “ReceivedMessage” event. So they give you that, you don’t have to use the other events. The DataAvailable event is probably not accessible. EasyUDPSocket is subclassed from UDPSocket. Xojo uses the UDPSocket.DataAvailable event, reads the Datagram and then formats it into a nice string, IP address, etc and then raises the ReceivedMessage event.
In the straight UDPSocket method you have access to all those items. But Read gives you a Datagram. A Datagram is an object that has the data that was sent, the IP address of the sender and the UDP port information.
Jon
Post by Jim Wagner
Thanks, Jon -
The DataAvailable event of the UDPSocket <file:///index.php/UDPSocket> class is not available.
Likewise, it says
Even though you have access to the Write and Read methods of the UDPSocket <file:///index.php/UDPSocket> class, you should never call them. Doing so will cause a RuntimeException <file:///index.php/RuntimeException> to be raised (with an appropriate message set). This is so the internal protocol is enforced
So, if you can’t read, how do you get to the data?
Jim
James Wagner
Oregon Research Electronics
http://www.orelectronics.net <http://www.orelectronics.net/>
Post by Jon Ogden
I use the regular UDP class. Works well.
There certainly is a DataAvailable event! EasyUDP does too. I think you are confused!
What you don't have is any guarantee that you communication will go through.
Going through firewalls for UDP is tricky. It can be done but you have to specifically set it up so that it will pass UDP packets. Generally UDP is mainly a LAN based protocol probably mainly due to the fact that the receiving devices are not guaranteed to receive a transmission like they are with TCP/IP.
Sent from my iPhone
Post by Jim Wagner
Greetings NUG -
I have an application where I have a device connected to the host via an ethernet cable. No switchers, routers, hubs, etc. Just plain direct cross-over cable.
This device broadcasts its ip address (and other information) via UDP on port 13000. EasyUDPSocket seems to be an appropriate tool to use, but I am greatly confused. The documentation says that it has no DataAvailable event - how are you supposed to access received data. The documentation only seems to talk about sending! It is also not clear how to add an EasyUDPSocket to the project. I add a generic object and EasyUDPSocket is not an option. I can add a UDPSocket and EasyUDPSocket is an option but it seems to want to give me “AutoDiscovery”. A bit of help would really be appreciated.
Also, can anyone provide some hints about how to manage the host’s firewall so that UDP packets can be received?
Many thanks
Jim
James Wagner
Oregon Research Electronics
http://www.orelectronics.net <http://www.orelectronics.net/>
_______________________________________________
https://forum.xojo.com/
_______________________________________________
https://forum.xojo.com/
_______________________________________________
https://forum.xojo.com/
_______________________________________________
https://forum.xojo.com/
_______________________________________________
https://forum.xojo.com/
_______________________________________________
https://forum.xojo.com/
_______________________________________________
https://forum.xojo.com/
_______________________________________________
https://forum.xojo.com/
_______________________________________________
https://forum.xojo.com/
______________________________________

Loading...