Visual Studio 2008, C++, MFC, Windows XP Pro, Ethernet NIC is Intel based, private LAN closed off from the world.
My application builds a packet that it sent to another computer via TCP/IP over Ethernet. The final structure is a conglomeration of three structures with the one in question looking like this:
Please excuse typos, I cannot cut and paste from the work computer.Code:Typedef struct
{
unsigned int date_tag;
unsigned int date_size;
unsigned int date_value;
unsigned int microseconds_tag;
unsigned int microseconds_size;
unsigned int microseconds_value;
unsigned int status_tag;
unsigned int status_size;
unsigned int status_value;
… couple more…
} TD_STATUS_BODY;
The structure is dictated by the vendor server application that receives this data. The tag values are integers that range from 1 to about 1K. All the size values are 4 indicating a four byte value. The problem is that the server does not accept the data. Using the debugger I get to the area that sends the structure and look at it before and after the call to the TCP class. All the sections are there and all parameters have the expected values, in their correct places. I threw in a few steps to get the address of each element and as expected, it increments by four each item.
I looked at some packets with Wire Shark and it shows that the values for microseconds_value are SHIFTED RIGHT by two bytes and overwrite the first two bytes of status_tag.
The microseconds value is hundreds of microseconds since midnight and uses almost the full 32 bits. All the others are much smaller and are just fine.
I have pondered this all day while working other tasks, but cannot think of anything that could possibly cause it. Every packet for this displays this problem, only in this one field.
Side note that might be related: I discovered that packets out of the computer had checksum errors. I resolved that by disabling the option to offload the checking to the adapter. I will be getting the latest drivers, but I really don’t think a driver would cause this problem.
While writing this I thought of forcing larger values into some of the other fields, and smaller values into the microseconds_value field. That might tell me something. Maybe I can declare another structure for microseconds and load it one byte at a time.
Has anyone seen a problem similar to this? Any clues?