#if defined(WIN32) /* Windows does not have ntohl, so define it here */ #define htonl(x) ntohl(x) int ntohl(int x){ int ret; unsigned char* pr = (unsigned char*) &ret; unsigned char* px = (unsigned char*) &x; pr[0] =px[3]; pr[1] = px[2]; pr[2] = px[1]; pr[3] = px[0]; return ret; } #else /* Unix does, so just use it */ #include /* for ntohl() macro */ #endif /* WIN32 */