Raised This Month: $51 Target: $400
 12% 

[EXTENSION] Socket (3.0.1)


Post New Thread Reply   
 
Thread Tools Display Modes
sfPlayer
Senior Member
Join Date: Dec 2007
Location: Germany
Old 06-18-2010 , 09:09   Re: [EXTENSION] Socket (3.0.1)
Reply With Quote #271

Is there a Location-header? Please post your plugin source and the header information. You can use Wireshark for debugging network traffic.
sfPlayer is offline
RealForce
Junior Member
Join Date: Jan 2010
Old 06-18-2010 , 10:24   Re: [EXTENSION] Socket (3.0.1)
Reply With Quote #272

Quote:
Originally Posted by sfPlayer View Post
Is there a Location-header? Please post your plugin source and the header information. You can use Wireshark for debugging network traffic.
ok here is the code

Code:
public OnClientAuthorized(client, const String:auth[])
{
    Socket = SocketCreate(SOCKET_TCP, OnSocketError);
    if ( Socket == INVALID_HANDLE )                          
        LogError("Unable to create socket.");
    else
    {
        SocketSetArg(Socket, client);       
        SocketConnect(Socket, OnSocketConnected, OnSocketReceive, OnSocketDisconnected, "www.blablabla.info", 80);
    }
}

public OnSocketConnected(Handle:socket, any:client)              
{
    decl String:steam_id[64];
    if(GetClientAuthString(client, steam_id, 64))
    {
        decl String:requestStr[256];
        Format(requestStr, sizeof(requestStr), "GET /validator.php?steamid=%s HTTP/1.0\r\nHost: %s\r\nConnection: close\r\n\r\n", steam_id, "www.blablabla.info");
        SocketSend(socket, requestStr);
    }
}
the validator.php gets the steamid and returns simple string. I've opened validator.php with my browser and it is working and showing simple string and nothing more.
The validator.php contains print function for showing the content and nothing more.

Last edited by RealForce; 06-18-2010 at 10:26.
RealForce is offline
sfPlayer
Senior Member
Join Date: Dec 2007
Location: Germany
Old 06-18-2010 , 10:51   Re: [EXTENSION] Socket (3.0.1)
Reply With Quote #273

Your request looks ok. You didn't post the receive-handler, I guess the problem lies there.
sfPlayer is offline
RealForce
Junior Member
Join Date: Jan 2010
Old 06-18-2010 , 11:41   Re: [EXTENSION] Socket (3.0.1)
Reply With Quote #274

Quote:
Originally Posted by sfPlayer View Post
Your request looks ok. You didn't post the receive-handler, I guess the problem lies there.
I forgot to post it.

Here is receive handler

Code:
public OnSocketReceive(Handle:socket, String:receiveData[], const dataSize, any:client)
{
    if(dataSize > 0)
    {
        PrintToChatAll(receiveData);
        
        if ( !StrEqual(receiveData, "hjkjhkjhk") )
        {
            PrintToChatAll("jhkjhkhjkjhkjhkjhkjhk");
        }                                                                          
        else
        {
            PrintToChatAll("gkgkjkjhkhjkhkhjkjhkh");
        }
    }
    CloseHandle(socket);
}
I really don't understand why I only get header response?

PrintToChatAll prints the receiveData but there is only header lines nothing more. there is Content-Length with correct size but I don't get the content string.

Last edited by RealForce; 06-18-2010 at 11:43.
RealForce is offline
sfPlayer
Senior Member
Join Date: Dec 2007
Location: Germany
Old 06-18-2010 , 11:48   Re: [EXTENSION] Socket (3.0.1)
Reply With Quote #275

The server might send the response in multiple packets. Move CloseHandle(socket) to OnScoketDisconnected to handle this.
sfPlayer is offline
Xp3r7
SourceMod Donor
Join Date: Jul 2006
Old 06-26-2010 , 22:57   Re: [EXTENSION] Socket (3.0.1)
Reply With Quote #276

Is this working with the latest CSS update?
__________________
Xp3r7 is offline
Send a message via MSN to Xp3r7
sfPlayer
Senior Member
Join Date: Dec 2007
Location: Germany
Old 06-26-2010 , 23:16   Re: [EXTENSION] Socket (3.0.1)
Reply With Quote #277

It doesn't depend on any mod-specific API.
sfPlayer is offline
Fishcake
Junior Member
Join Date: Feb 2009
Location: England
Old 06-27-2010 , 06:16   Re: [EXTENSION] Socket (3.0.1)
Reply With Quote #278

I've noticed some people have managed to remove the headers from the response.

How would I go about doing this?
Fishcake is offline
Send a message via MSN to Fishcake
sfPlayer
Senior Member
Join Date: Dec 2007
Location: Germany
Old 07-01-2010 , 00:45   Re: [EXTENSION] Socket (3.0.1)
Reply With Quote #279

I postet that already multiple times. Search für \r\n\r\n and consider searching those bytes in multiple consecutive packets across the borders.
sfPlayer is offline
Fishcake
Junior Member
Join Date: Feb 2009
Location: England
Old 07-03-2010 , 06:50   Re: [EXTENSION] Socket (3.0.1)
Reply With Quote #280

Cool ok, I've managed to get rid of the headers, now I'm left with my result sandwiched between two numbers.

4
true
0

'true' being the value that my PHP page is returning.

What are the other two values?
Fishcake is offline
Send a message via MSN to Fishcake
Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 10:00.


Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Theme made by Freecode