Unix Programming - Re: altering struct while in transition, how difficult?[was struct

This is Interesting: Free IT Magazines  
Home > Archive > Unix Programming > August 2006 > Re: altering struct while in transition, how difficult?[was struct





You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

Author Re: altering struct while in transition, how difficult?[was struct
Rainer Temme

2006-08-16, 1:25 pm

ibaloubi wrote:
> Using the application from my linux workstation to my dedicated server
> ( server on the dedicated part) then the information is tampered with. I
> get a zero in m_iState, despite the digit should ( which I am absolutely
> sure of) be a 1 or 2 depending on the state. The code used on the lan is
> the same as from over the internet from my workstation to the dedicated
> server.


> so:the data is changed in transmission, and I want to know how this is
> possible,


ibaloubi,

The things to do and check that come to mind immediately are...

1) make sure, that the structure was written completely ...
add a printf of a sizeof(your_structure) somewhere
and add printfs of the results of the writes. Depending on
your socket-settings you cannot expect that the structure is
written at once (with one call). Your code needs to handle this.

2) tcpdump the transmission (eventually on both sides)
tcpdump -nn port xxxx (or host xxxx) should be good enough
to filter out the relevant information. (Replace xxx with the
portnumber you are communicating or with the ip address in the
second case).

3) make sure, the structure was received completely.
Print out a sizeof(your_struct) and the resultcode
of the relevant read()/recv()s. Make sure you understand,
that you cannot expect the structure to be received in one
piece (with one read/recv call). Your code needs to be
written to support that.

With that information at hand, you should be much nearer to
where the problem is.

It is not impossible, but very very unlikely, that your
data is modified 'somewhere' in transit on the network.

Rainer
Sponsored Links






Free braindumps | Software forum | Database administration forum

Copyright 2003 - 2008 webservertalk.com