Hi Luis,
I’m glad you asked. The SNAP-PAC controller firmware currently has support for communicating via udp using communication handles (just like tcp), we just don’t “officially” support it.
That is, we haven’t fully documented/tested all the ways it could be used and abused so it’s an “at your own risk” feature at the moment, partly because udp is tricky, and using it with our current implementation you have to handle sequencing of packets yourself.
However, every time a SNAP-PAC controller communicates to an Ethernet brain, it’s using an internal udp comm handle. This feature is on the list of undocumented features we plan to officially support/document in the (hopefully near) future. Be sure you’re subscribed to OptoNews to make sure you don’t miss when it’s officially supported.
In the meantime, using a udp comm handle is very similar to tcp, just use “udp” in place of “tcp” in your comm handle’s initial value or set it using the Set Communication Handle Value command BEFORE doing the Open Outgoing Communication command. You can omit the IP address if you don’t need it (so the comm handle might be something like “udp:22004”).
Other tidbits that may be helpful:
• A document on port numbers: http://www.opto22.com/documents/1940_TCP_and_UDP_Port_Assignments_Tech_Note.pdf
• Controller firmware version 9.1 has get.src & set.dest options in Send Communication Handle Command:
[INDENT]If you haven’t already, you may want to upgrade to 9.1 firmware since Send Communication Handle Command now includes these options which may be useful to you:
-
For both udp and tcp, the new [B]get.src[/B] command returns the IP address from which the connection originated.
-
For upd, the new command, [B]set.dst:n.n.n.n:pppp[/B], sets the destination for the next messages, until another set.dst command is sent.
[/INDENT]
• [B]PAC Sim[/B]: Your udp comm handles should work in [URL=“http://www.opto22.com/site/downloads/dl_drilldown.aspx?aid=3690”]PAC Sim too, which might be helpful for testing.
-OptoMary