Raised This Month: $ Target: $400
 0% 

[HELP] Sockets problem ( recieve )


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
Author Message
red_bull2oo6
Senior Member
Join Date: Mar 2012
Location: Braila, Romania
Old 08-02-2013 , 07:34   [HELP] Sockets problem ( recieve )
Reply With Quote #1

hi again, i tried to get the page info from This link but it's not working..

i have this code, connection is done but i receive empty info.



PHP Code:
/* Plugin generated by AMXX-Studio */

#include < amxmodx >
#include < sockets >

#define PLUGIN "Socket Test#2"
#define VERSION "1.0"

enum _:iServerData
{
    
DATA256 ],
    
HOST20 ],
    
REQUEST128 ],
    
SOCKET,
    
ERROR
}

new 
g_ServerDataiServerData ];

public 
plugin_init( )
{
    
register_pluginPLUGINVERSION"Askhanar" );
    
    
FormatHostAndRequest( );
    
set_task5.0"GetPlayerInfo"112233 );
    
    
// Add your code here...
}

FormatHostAndRequest( )
{    
    
g_ServerDataHOST ] = "gametracker.com";
    
formatexg_ServerDataREQUEST ], sizeof g_ServerDataREQUEST ] ) -1,"GET /player/Askhanar/188.212.106.110:27015/ HTTP/1.1^nHost:%s^r^n^r^n"g_ServerDataHOST ] );
}


public 
GetPlayerInfo( )
{
    
    if( 
g_ServerDataSOCKET ] > )
        
socket_closeg_ServerDataSOCKET ] );
    

    
g_ServerDataSOCKET ] = socket_openg_ServerDataHOST ], 80SOCKET_TCPg_ServerDataERROR ] );
    
    if( 
g_ServerDataERROR ] == && g_ServerDataSOCKET ] > )
    {
        
socket_sendg_ServerDataSOCKET ], g_ServerDataREQUEST ], strleng_ServerDataREQUEST ] ) );
        
set_task0.1"task_ReciveData"g_ServerDataSOCKET ] );
    }
    else
    {
        switch( 
g_ServerDataERROR ] )
        {
            case 
1:    log_amx("[ERROR] Unable to create socket." );
            case 
2:    log_amx("[ERROR] Unable to connect to hostname." );
            case 
3:    log_amx("[ERROR] Unable to connect to the HTTP port." );
            
        } 
        
        
set_fail_state"An error occured, read logs." );
    }
    
}

public 
task_ReciveData( )
{
    if( !
socket_changeg_ServerDataSOCKET ], ) )
    {
        
set_task0.1"task_ReciveData"g_ServerDataSOCKET ] );
        return;
    }
    
    
socket_recvg_ServerDataSOCKET ], g_ServerDataDATA ], sizeof g_ServerDataDATA ] ) -);
    
    
log_amx"Recieved: %s"g_ServerDataDATA ] );
    
    
socket_closeg_ServerDataSOCKET ] );
    
g_ServerDataSOCKET ] = 0;

and in logs i have this:

Code:
L 08/02/2013 - 14:27:37: -------- Mapchange to awp_india --------
L 08/02/2013 - 14:27:43: [2.amxx] Recieved:
what's going wrong ? is the host sending me blank info?
red_bull2oo6 is offline
 



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 15:45.


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