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.

--
John Beranek                         To generalise is to be an idiot.
http://redux.org.uk/                                 -- William Blake

_______________________________________________
hlds_apps mailing list
[EMAIL PROTECTED]
http://list.valvesoftware.com/mailman/listinfo/hlds_apps

Reply via email to