The server only runs on x86 hardware so no need to convert endian-ness (is that a word?) of the data.
- Alfred ----Original Message---- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of John Beranek Sent: Tuesday, August 24, 2004 1:55 AM To: [EMAIL PROTECTED] Subject: Re: [hlds_apps] Source RCON format > Just a little question below... > > Alfred Reynolds wrote: > > > Okay, I spent a few minutes and whipped up a sample RCON client > > implementation. This is ugly, ugly code but it should compile for > > linux users. Win32 people need to do the WSAStartup() dance amongst > > other things. > [snip] > > struct sockaddr_in rcon_server; > > rcon_server.sin_family = AF_INET; > > rcon_server.sin_addr.s_addr = inet_addr( "127.0.0.1" ); > > rcon_server.sin_port = htons( 27015 ); > > > > if ( connect( sock, (const struct sockaddr *)&rcon_server, sizeof( > > rcon_server ) )!= 0 ) { > > printf( "Unable to connect\n"); > > exit(-1); > > } > > > > unsigned char send_buf[4096]; > > unsigned char *send_ptr = send_buf + sizeof(int); > > > > *(int *)send_ptr = 0x0001; // request id 1 > > send_ptr += sizeof(int); > > *(int *)send_ptr = 0x0003; // command id 3 > > send_ptr += sizeof(int); > > No htonl() ? What byte order are you presuming at the server end? > > John. _______________________________________________ hlds_apps mailing list [EMAIL PROTECTED] http://list.valvesoftware.com/mailman/listinfo/hlds_apps
