For Programmers: Free Programming 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
Nils O. Selåsdal

2006-08-16, 8:03 am

ibaloubi wrote:
> Barry Margolin wrote:
>
> not trying to do anything but understand why my network behaves like it
> does.using the client-server app over my lan worked fine, until the read
> part in the client started throwing "connection reset by peer"
> errorrs( which the server on lan never does until the whole struct has been
> transmitted(it is a simple server)).
>
> 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

No it is not. Some of your assumtions are likely wrong.

Here's some things to check:
* Can your server and workstation can interpret this structure the same
way. If both runs on a similar CPU, running a similar OS, and your
program is compiled by the same compiler , then probably yes.
If not you need to figure out how the struct is represented
internally on both machines and convert between them in some way.

* Are you sure you read the entire struct on the receiving end, and not
just parts of it ? One read/recv call might just give you parts of the
data that was just sent. Be sure even the write call writes
very thing, write can write less than you tell it to.

* Plain old bug. You might just have a bug somewhere. Show the entire
source code if you want anyone to verify.
Remember to check rethrn codes of /all/ calls, etc.



Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2008 codecomments.com