08-24-2009 08:46 PM - edited 08-24-2009 08:47 PM
Guys,
I'm having a hard time sending and receiving broadcast packets at 255.255.255.255 using the provided example. Could someone please help me out to see what am I missing? I have no problem doing this sort of things in java but labview is tricky. Thanks
Solved! Go to Solution.
08-25-2009 12:54 AM
255.255.255.255 is is a broadcast address NOT a multicast address. Why would you want to send a multicast to a broadcast address? That makes no sense.
Try a multicast address in the valid range of 224.0.0.0-239.255.255.255.
08-25-2009 01:01 AM - edited 08-25-2009 01:02 AM
Try the plain UDP open/UDP write (not multicast!) With an address of 255.255.255.255. Seems to work just fine.
(open the UDP sender.vi example, it even has a button to optionally send to the broadcast address xFFFFFFFF)
08-25-2009 11:23 AM
08-25-2009 12:23 PM
08-25-2009 01:40 PM
lavalava wrote:
Another quick question, it seems that these UDP blocks are automatically converting all incoming data from bytes to ASCII.
No, they are simply represented as strings (i.e. a series of bytes). You can typecast them to whatever you want.
(ASCII is a way of encoding bytes into characters and is irrelevant here. Strings != ASCII.)
lavalava wrote:
And is 548 is really the maximum byte array size can be read/write? Is there a way to make it go higher than that?
I don't know where you got that number. Read the help for UDP write:
"In an Ethernet environment, restrict data to 8192 bytes. In a LocalTalk environment, restrict data to 1458 bytes to maintain gateway performance."
548 is the default size for reading, but you can set it to anything you want (within reasonable limits, but read the warnings in the online help!).
For broadcast use, I would probably recomment to keep it below the MTU value so it fits into a single UDP packet and does not need to be fragmented by the underlying driver. What size data do you have in mind?
08-26-2009 01:04 PM - edited 08-26-2009 01:05 PM
08-26-2009 01:12 PM
You still seem to have problems understanding strings. They have nothing to do with ASCII.
Can you tell us what kind of "parsing" you need to do? I am sure there is the equivalent of a "one liner" that does it all. 🙂
Please attach a small VI containing a typical string as diagram constant and tell us what output you need. 🙂
08-26-2009 01:22 PM - edited 08-26-2009 01:25 PM
I think we will be on the same page if you can run both receiver and transmitter. Sorry if this takes some of your time away but it's probably easier to see it.
Ok, here is my intention. Say I'm sending 0xAABBCCFF. On the receiving, the UDP reader automatically converts 0xAABBCCFFto ASCII. If I right click on the output indicator "Data Received" and pick "Hex display", it shows 0xAABBCCFF which is good but the problem is my parser is expecting 0xAABBCCFF. I can't feed the output straight into my parser as 0xAABBCCFF because UDP reader already defaulted itself to output as ASCII as "ª»Ìÿ". So obviously, I have do some data manipulation so I will see 0xAABBCCFF or simply "AABBCCFF" as string format. How do I do that?
08-26-2009 01:27 PM
A byte is a byte. A byte in a string can show up as an ASCII character (normal mode), a hex value that goes from 00-FF (hex mode, it takes to spaces on the screen, but each pair of hex values is still only one byte). It can show up as a numerical value in an integer numeric indicator as 0-255 in decimal display or 00-FF in hex display (binary and octal are also available).
If you want a byte such decimal65, hex 41, or ascii character A to show up in a string that is the two string characters of a "4" and a "1", then you have to do some manipulation.
As for typecast, it takes any kind of input and converts it to something else. Maybe what you want, maybe not. The only way to know all that it can do is to experiment with it.