UDP send data struct using AddData()
Posted: Tue Apr 17, 2012 6:25 pm
I've got a complicated data structure that I wanted to send out as a UDP packet using the C++ class. Is this possible?
My issue is that the C++ constructors seem to be limited to a BYTE a WORD or a null terminated string.
Here's just part of my struct below I'm trying to send. As you can see there are different BYTE arrays encompassed within the struct, so even doing pkt.AddData(NodeReport); doesn't work since I need it to send the full padded size and not null terminate.
Is it possible to do this? Or am I going to be stuck re-writing to use sockets instead?
Thanks
Scott
My issue is that the C++ constructors seem to be limited to a BYTE a WORD or a null terminated string.
Here's just part of my struct below I'm trying to send. As you can see there are different BYTE arrays encompassed within the struct, so even doing pkt.AddData(NodeReport); doesn't work since I need it to send the full padded size and not null terminate.
Is it possible to do this? Or am I going to be stuck re-writing to use sockets instead?
Thanks
Scott
Code: Select all
BYTE ID[8]; // 'Art-Net' 0x00 null terminated.
WORD OpCode; // low byte first.
BYTE IPAddress[4];
WORD Port; // always 0x1936 low byte first.
BYTE VersInfoH;
BYTE VersInfo;
BYTE NetSwitch;
BYTE SubSwitch;
BYTE OemHi;
BYTE Oem;
BYTE UbeaVersion;
BYTE Status1;
WORD ESTAMan;
BYTE ShortName[18];
BYTE LongName[64];
BYTE NodeReport[64];
BYTE NumPortsHi;
BYTE NumPortsLo;
BYTE PortTypes[4];
BYTE GoodInput[4];
BYTE GoodOutput[4];
BYTE Swin[4];
BYTE Filler[26];