The server sends back 4.000 but Windows reads it as 0.0.
I tried changing the byte order using this on Windows:
void ReverseFloat(float* f)
{
unsigned char* uc = (unsigned char*)f;
unsigned char temp = uc[0];
uc[0] = uc[3];
uc[3] = temp;
temp = uc[1];
uc[1] = uc[2];
uc[2] = temp;
}But the server now gets 8.47518e+11 and Windows gets 0.0.
The struct is packed and it still gives me the wrong result.
#if !defined( _SERVER )
#pragma pack(push, 1)
#endif
typedef struct
{
unsigned char type;
float version;
char username[16];
char password[16];
}
#if defined( _SERVER )
__attribute__ ((packed))
#endif
LoginPacket;
#if !defined( _SERVER )
#pragma pack(pop)
#endifThe client sends 37 bytes and server receives 37 bytes.
The server sends back this:
#if !defined( _SERVER )
#pragma pack(push, 1)
#endif
typedef struct
{
unsigned char type;
float version;
}
#if defined( _SERVER )
__attribute__ ((packed))
#endif
WrongVersionPacket;
#if !defined( _SERVER )
#pragma pack(pop)
#endifThe server says it sends 8 bytes for some reason and the client receives 8. I don't know why it's 8... should be 5. Is a float 7 bytes on Amazon Linux?
Edited by polyfrag, 03 July 2012 - 10:36 AM.






