hi all,

after a search over the net i didn't find any answer, so i'm back here, in the old dear win32asm site... the house of genius..

this is my mistery (sorry for C, asm is not very good for portability on power pc :) )

i have 2 applications, a server and a client. Server run on win2k, client on CE 3.00 pocket pc. I would tranfer an integer as binary, from server to client, to give to the client the size of the file that will follow.

if i do :

char sz_OutString [4] = "";

FileSize = GetFileSize (hFile, NULL);
memcpy (&sz_OutString, &FileSize, 2);

send (sock, (char *) &sz_OutString, 2, NO_FLAGS_SET);

the client receive 2 butes, but both with value 255, not 250 & 87 as i'm waiting as file size.


if i do :

char sz_OutString [4] = "\372\127";

send (sock, (char *) &sz_OutString, 2, NO_FLAGS_SET);

the client receive right 250 as byte [0] and 87 as byte [1].


I really can't understand the difference. On first case i copy the memory, watching with the debugger the buffer is the same of the 2nd case before the send.

I really don't now how to get out.

Any idea is very appreciated.

Thanks B7
Posted on 2003-04-02 12:05:40 by Bit7
now i can answer to myself....

How terrible problem ... a day spent for such a stupid thing..

Seems a CE problem, The problem was just about m$ visualC...

Yes, i was tryig to send the FileSize as binary from win2k to winCE using sockets, and i was wondering why i was send correctly 2 bytes (250 & 87 values) and in win CE i was receiving 2 byte to 255....

In vc++, debug mode, i get the correct file file size, becouse vc++ take the current path of the file i want to transfer (a jpeg) correctly (i put it in the debug folder, where the built exe stay, and here i tought was the right path couse i had it as returned by the GetCurrentDirectory API).

To check the bytes received on client application in CE i was running the server w2k app without debug, debugging only the client. So i couldn't see that out of debugging mode GetCurrentDirectory return the upper project directory where CreateFile couldn't find my jpeg. That's why on CE i was receiving two bytes as 255 (FileSize uninitialized).

A day spent for this stupid issue :( I think i will remember well my lesson.


Bye and thanks.
B7
Posted on 2003-04-03 14:50:12 by Bit7