I am gathering binary information from a multicast stream on a VERY old system. I have converted most of it, but I am having problems with a High / Low DWORD Combo. I wrote a little test app to try to iron this out. I am being told the value should be in the 30XXX range.
The documentation I was given says it is defined as ...
DWORD ID_HIGH;
DWORD ID_LOW;
I am just getting garbage so far. I have tried bit shifts and a bunch of other routes. So far, no luck. Any assistance is appreciated.
static void Main(string[] args)
{
byte[] data = { 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xF3, 0x04, 0x51};
Int32 ID_High = IPAddress.NetworkToHostOrder(BitConverter.ToInt32(data, 0));
Int32 ID_Low = IPAddress.NetworkToHostOrder(BitConverter.ToInt32(data, 4));
Int64ToInt32 i6;
i6.Int64Value = 0;
i6.LeftInt32 = ID_High;
i6.RightInt32 = ID_Low;
}
[StructLayout(LayoutKind.Explicit)]
struct Int64ToInt32
{
[FieldOffset(0)]
public Int64 Int64Value;
[FieldOffset(0)]
public Int32 LeftInt32;
[FieldOffset(4)]
public Int32 RightInt32;
}
For More information. Here is the entire byte[] received from the Multicast.
byte[] data = { 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xF3, 0x04, 0x51, 0x00, 0x00, 0x00, 0x10, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xF3, 0x04, 0x50, 0x00, 0x00, 0x04, 0x7F,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x05, 0x90, 0x3E, 0xE4, 0x62, 0xB8, 0xB1, 0x4D, 0xB0, 0xF1, 0x15, 0x94,
0xF1, 0x13, 0x0F, 0x84, 0x00, 0x00, 0x00, 0x00, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x00 };
And here is the definition of what it is supposed to translate to.
typedef struct
{
DWORD AgentID_High; // Agent phoneset login ID high-order 32 bits
DWORD AgentID_Low; // Agent phoneset login ID low-order 32 bits
DWORD State;
DWORD SupervisorID_High; // Supervisor phoneset login ID high-order 32 bits
DWORD SupervisorID_Low; // Supervisor phoneset login ID low-order 32 bits
DWORD TimeInState;
DWORD AnsweringSkillset;
DWORD DNInTimeInState;
DWORD DNOutTimeInState;
BYTE SupervisorUserID[16];
DWORD PositionID;
// TM26314
DWORD NotReadyReasonCode_High;
DWORD NotReadyReasonCode_Low;
DWORD DNOutCallNumber_High;
DWORD DNOutCallNumber_Low;
DWORD SkillsetCallAnswered;
DWORD DNInCallAnswered;
DWORD DNOutCallMade;
//Q00635846 griffinn MIROS Changes
DWORD AnsweringApplication;
DWORD AnsweringCDN_High;
DWORD AnsweringCDN_Low;
DWORD AnsweringDNIS_High;
DWORD AnsweringDNIS_Low;
} NIMultiCastAgentRecord_Rls5; // size = 104 bytes
All the other DWORDS parse fine with just IPAddress.NetworkToHostOrder(BitConverter.ToInt32(data, 0)); Except these split words. I personally thought the data didn't seem right but I wanted second opinions.
**Latest Development.. The agent ID is 30451 from what I am being told. if you look at the hex bits it is right there in the HEX.
byte[] data = { 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xF3, 0x04, 0x51};
So here is what I came up with. I feel like I am breaking all kinds of rules here...
string AgentID = BitConverter.ToString(data);
AgentID = AgentID.Replace("-", "").Replace("F", "");