Results 1 to 8 of 8

Thread: Winsock search Half-Life

  1. #1

    Thread Starter
    Frenzied Member vbNeo's Avatar
    Join Date
    May 2002
    Location
    Jutland, Denmark
    Posts
    1,994

    Winsock search Half-Life

    Is it possible to search a Half-Life server via the Winsock control, and retrieve info from it ? If it is, could anyone tell me how to do it, just give me the theory...

    Cheers!
    "Lies, sanctions, and cruise missiles have never created a free and just society. Only everyday people can do that."
    - Zack de la Rocha


    Hear me roar.

  2. #2
    Fanatic Member scr0p's Avatar
    Join Date
    Oct 2002
    Location
    VA
    Posts
    720
    Good and bad news, good news is its possible, I attemped to do it before, but for the bad news, I dont know what commands to send once I connect to WON.NET, and I can not find ANY documentation, only people telling me to DL and study the SDK.. this is my program, I made it a long time ago, It isnt really a program, I just put some code together to see if I can connect to WOn.NET:

    VB Code:
    1. Option Explicit
    2.  
    3. Private Sub Form_Load()
    4.     Winsock1.RemoteHost = "half-life.east.won.net"
    5.     Winsock1.RemotePort = 6003
    6.     Winsock1.Connect
    7. End Sub
    8.  
    9. Private Sub Winsock1_Connect()
    10.     Form1.Print "Connected"
    11.     Winsock1.SendData "update"
    12. End Sub
    13.  
    14. Private Sub Winsock1_ConnectionRequest(ByVal requestID As Long)
    15.     Form1.Print "winsock1_connectionRequest invoked"
    16. End Sub
    17.  
    18. Private Sub Winsock1_DataArrival(ByVal bytesTotal As Long)
    19.     Dim Killer
    20.     Winsock1.GetData Killer
    21.     List1.AddItem Killer
    22. End Sub
    23.  
    24. Private Sub Winsock1_Error(ByVal Number As Integer, Description As String, ByVal Scode As Long, ByVal Source As String, ByVal HelpFile As String, ByVal HelpContext As Long, CancelDisplay As Boolean)
    25.     Form1.Print ("Error: " & Description)
    26. End Sub
    27.  
    28. Private Sub Winsock1_SendProgress(ByVal bytesSent As Long, ByVal bytesRemaining As Long)
    29.     Form1.Print "Winsock1_SendProgress invoked"
    30.     Form1.Print bytesSent
    31.     Form1.Print bytesRemaining
    32. End Sub
    asdf

  3. #3
    Fanatic Member scr0p's Avatar
    Join Date
    Oct 2002
    Location
    VA
    Posts
    720
    After you somehow get the servers to show, you can make code to open the server on click by using the shortcut, lets say for CS: itll be:
    Shell("C:\SIERRA\Half-Life\hl.exe -noforcemparms -game cstrike -noforcemaccel -console +connect " & ServerIP,1)
    asdf

  4. #4

    Thread Starter
    Frenzied Member vbNeo's Avatar
    Join Date
    May 2002
    Location
    Jutland, Denmark
    Posts
    1,994

    hmm

    Thanks scr0p, could you link to the SDK ? i wanna figure it out... i figured out the IRC RFC so this shouldnt be THAT hard .

    Cheers!
    "Lies, sanctions, and cruise missiles have never created a free and just society. Only everyday people can do that."
    - Zack de la Rocha


    Hear me roar.

  5. #5
    Fanatic Member scr0p's Avatar
    Join Date
    Oct 2002
    Location
    VA
    Posts
    720
    I will try to find the link in a few. I think you need to know C/C++ tho.



    -----

    http://www.computergames.ro/download...wnload&did=444 111MB

    Actually I am DLing this now too, your wanting to learn inspired me


    ----

    mIrrOr: (this has source-only version too)

    http://dev.valve-erc.com/index.php?go=hl_sdk
    Last edited by scr0p; Jan 12th, 2003 at 09:48 AM.
    asdf

  6. #6
    Fanatic Member seec77's Avatar
    Join Date
    Jan 2003
    Posts
    596

    Thumbs up

    could you guys tell us how to do it when you find out, that will be very nice.
    Best Regards,
    seec77

    If you helped me, cosinder yourself thanked.

    Get each and every Garfield strip here!
    Here you can get all Calvin & Hobes strips!
    Damn UComics! It was probably unprofitable for them to allow us to just download Garfield and Calving & Hobes strips... so they made folder indexing unallowed on their server!!!

    I am 33% addicted to Counterstrike. What about you?
    I am 23% addicted to Star Wars. What about you?
    I am 0% addicted to Tupac. What about you?

  7. #7
    Fanatic Member scr0p's Avatar
    Join Date
    Oct 2002
    Location
    VA
    Posts
    720
    I installed the SDK, I am reading this file at the moment: maybe I should learn C/C++ first^_^



    Request full server list from HL master server.
    ==================
    */
    void Host_GetBatchServerList_f( void )
    {
    unsigned char c[10];
    adrlist_t *p;
    int i = 0;

    // Request a server list from the master servers.
    NET_Config( true ); // Initialize networking

    if ( gfNoMasterServer )
    return;

    if ( !valvemaster_adr )
    return;

    c[0] = A2M_GET_SERVERS_BATCH; // ascii 'e'
    i++;

    *(int *)&c[1] = 0; // Request first batch.
    i += sizeof( int );

    p = valvemaster_adr;

    while ( p )
    {
    // send to valve master
    Con_Printf ("Requesting batch server list from %s\n", NET_AdrToString ( p->adr) );
    NET_SendPacket (NS_CLIENT, i, c, p->adr );
    p = p->next;
    }
    }

    // Upon receiving ( 5 bytes, 4 for the -1 and 1 byte for the 'f' character ):
    int32 -1
    M2A_SERVER_BATCH // Ascii 'f', the response to the above

    void CL_ParseBatchServerList( void )
    {
    char szAddress[128] = "";
    unsigned char cIP[4];
    int i;
    unsigned short iIPPort;
    int nNumAddresses;
    int count = 1;
    int unique = 0;

    MSG_ReadByte(); // Skip \r

    unique = MSG_ReadLong();

    // So far we have read 6 chars. Remainder of message length is iBytesRead - 6
    nNumAddresses = net_message.cursize - sizeof(int) - sizeof(unsigned char) - sizeof(byte);

    // Each address is 6 bytes long
    //
    nNumAddresses /= 6;

    while (nNumAddresses-- > 0)
    {
    memset(szAddress, 0, 128);

    for (i = 0; i < 4; i++)
    cIP[i] = MSG_ReadByte();

    sprintf( szAddress, "%i.%i.%i.%i"
    , (int)cIP[0]
    , (int)cIP[1]
    , (int)cIP[2]
    , (int)cIP[3]
    );

    iIPPort = BigShort((unsigned short)MSG_ReadShort());

    //if ( count <= 100 )
    // Con_Printf( "%4i: %s:%i\n", count, szAddress, iIPPort );

    count++;
    }

    Con_Printf( "%i servers\n", count );

    if ( unique != 0 ) // More servers left, send another request to master
    {
    unsigned char c[10];
    int i = 0;

    // Request a server list from the master servers.
    NET_Config( true ); // Initialize networking

    c[0] = A2M_GET_SERVERS_BATCH;
    i++;

    *(int *)&c[1] = unique; // Request servers starting after this unique id.
    i += sizeof( int );

    // send to valve master
    Con_DPrintf ("Requesting next batch ( %i ) server list from %s\n", unique, NET_AdrToString ( net_from ) );
    NET_SendPacket (NS_CLIENT, i, c, net_from );
    }
    else
    Con_Printf( "Done.\n" );
    }
    asdf

  8. #8
    Fanatic Member seec77's Avatar
    Join Date
    Jan 2003
    Posts
    596

    i found the answer

    i found the answer to the problem!!
    i attached a text file i found in the sdk... i don't really understand what it means, but i am 99% sure it is what you guys need!! who's the man?? *lol*
    Attached Files Attached Files
    Best Regards,
    seec77

    If you helped me, cosinder yourself thanked.

    Get each and every Garfield strip here!
    Here you can get all Calvin & Hobes strips!
    Damn UComics! It was probably unprofitable for them to allow us to just download Garfield and Calving & Hobes strips... so they made folder indexing unallowed on their server!!!

    I am 33% addicted to Counterstrike. What about you?
    I am 23% addicted to Star Wars. What about you?
    I am 0% addicted to Tupac. What about you?

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width