Results 1 to 6 of 6

Thread: Sockets Help

  1. #1

    Thread Starter
    Member
    Join Date
    Feb 2006
    Posts
    61

    Sockets Help

    i have a sub from a cgi script i found that connects to a bf2 server and you send asp commands (getplayerinto.aspx?play='") etc, but i cant get the server to return my commands... ill get a null exception

    sub bf2webreq($) {
    my $req = shift;
    my ($line, $reply);

    my $sock = new IO::Socket::INET (PeerAddr => "bf2web.gamespy.com",
    PeerPort => 80,
    Proto => "tcp") || return(undef);
    print $sock "GET /ASP/$req HTTP/1.1\r\n";
    print $sock "Host: BF2Web.gamespy.com\r\n";
    print $sock "User-Agent: GameSpyHTTP/1.0\r\n";
    print $sock "Connection: close\r\n";
    print $sock "\r\n";

    return(undef) unless (defined($line = <$sock>));
    return(undef) unless ($line =~ /^HTTP\/\d\.\d 200 /);
    while (defined($line = <$sock>)) {
    last if ($line =~ /^\s*$/);
    }
    while (defined($line = <$sock>)) {
    $reply .= $line;
    }
    close($sock);

    return($reply);
    }


    does somebody wanna help me out getting this server to reply so i can begin building my program... i'd aprecitate it...

  2. #2
    Super Moderator Shaggy Hiker's Avatar
    Join Date
    Aug 2002
    Location
    Idaho
    Posts
    35,251

    Re: Sockets Help

    Try posting into C or C#, this is VB, and your code certainly isn't.
    My usual boring signature: Nothing

  3. #3

    Thread Starter
    Member
    Join Date
    Feb 2006
    Posts
    61

    Re: Sockets Help

    listen and read everything i say... it is a cgi script and it needs to be converted to vb.net

  4. #4

    Thread Starter
    Member
    Join Date
    Feb 2006
    Posts
    61

    Re: Sockets Help

    does noone have any clue?

  5. #5
    Old Member moeur's Avatar
    Join Date
    Nov 2004
    Location
    Wait'n for Free Stuff
    Posts
    2,712

    Re: Sockets Help

    maybe you should post the VB.NET code instead.
    And please enclose the code in between [Highlight=VB] tags

  6. #6
    Super Moderator Shaggy Hiker's Avatar
    Join Date
    Aug 2002
    Location
    Idaho
    Posts
    35,251

    Re: Sockets Help

    Quote Originally Posted by c0rrupt
    listen and read everything i say... it is a cgi script and it needs to be converted to vb.net
    You do mention a cgi script, you don't mention anything about converting to VB in the original post. Had you done so, I'm sure you would have gotten a much different answer.

    I assume that when you say you are getting a null exception error, you mean that you have already done much of the conversion and are getting an error in the new code. If that is correct, post the VB code.
    My usual boring signature: Nothing

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