help - Socket sa:mp
#1

Hi
I'm trying to learn a bit of socket, mainly about sa:mp protocol

I'm using the BlueG socket plugin to try to get how many players a server has and some other server info.

Do you know the game-monitor? It can get a lot of server info, as players online, map name, gamemode name, maxplayers, password needed and a lot more

So, is possible to get the same information using the socket plugin? how?

I researched a lot about the subject and I found it: http://pastebin.com/WTR6wP8V
It's a way to get some server information using the PHP plugin method, but I don't know much about PHP
I tried, but my best discovery was that this part of code is the responsable for the "socket protocol" information

PHP код:
        $fp = @fsockopen('udp://' $ip$port$errno$errstr,3) or $this->erro($errstr,__LINE__,__FILE__,$errno);
        if(
$fp){
            
$packet 'SAMP';
            
$packet .= chr(strtok($ip'.'));
            
$packet .= chr(strtok('.'));
            
$packet .= chr(strtok('.'));
            
$packet .= chr(strtok('.'));
            
$packet .= chr($port 0xFF);
            
$packet .= chr($port >> 0xFF);
           
            
fwrite($fp$packet.'i');
            
stream_set_timeout($fp,10);
            
fread($fp11);
            
$conInfo=stream_get_meta_data($fp);
            if(
$conInfo['timed_out']){
                
$this->erro("Connection timed out!");
            } 
but I still don't understand and don't know how to use that with BlueG socket plugin

and an other ask about socket (if some knowledgeable soul can help), socket works just with strings?
I mean, a socket is just a packet, or, a string sent to a "target" ?

if anyone has any good source of learning for noobs about socket, I would be grateful if shared

by the way, back to the main question, "what should I write on a socket to get the server information as response"?

thanks
Reply


Messages In This Thread
help - Socket sa:mp - by dudaefj - 01.06.2012, 16:14
Re: help - Socket sa:mp - by dudaefj - 02.06.2012, 00:11
Re: help - Socket sa:mp - by Jonny5 - 02.06.2012, 02:17
Respuesta: Re: help - Socket sa:mp - by dudaefj - 02.06.2012, 02:42
Re: help - Socket sa:mp - by Jonny5 - 02.06.2012, 02:46
Respuesta: Re: help - Socket sa:mp - by dudaefj - 02.06.2012, 03:02
Re: help - Socket sa:mp - by Jonny5 - 02.06.2012, 03:17
Respuesta: Re: help - Socket sa:mp - by dudaefj - 02.06.2012, 03:28
Re: help - Socket sa:mp - by Jonny5 - 02.06.2012, 03:47

Forum Jump:


Users browsing this thread: 3 Guest(s)