hello guy! i try to learne how use socket in glua. So ive found 2 "modul" gsock2 et bromsock.
gsock2 is down ( no link to download)
bromsock is a 2008 edition.
So witch of then is up to date ? where ca i found them ?
I juste wan't to make a basic query like my php scripte :
[CODE]
<?php
$ip = '192.168.1.200';
$queryport = 27015;
$socket = @fsockopen("udp://".$ip, $queryport , $errno, $errstr, 1);
stream_set_timeout($socket, 1);
stream_set_blocking($socket, TRUE);
fwrite($socket, "\xFF\xFF\xFF\xFF\x54Source Engine Query\x00");
$response = fread($socket, 4096);
@fclose($socket);
$packet = explode("\x00", substr($response, 6), 5);
$server = array();
//
$server['name'] = $packet[0];
$server['map'] = $packet[1];
$server['game'] = $packet[2];
$server['description'] = $packet[3];
$inner = $packet[4];
$server['players'] = ord(substr($inner, 2, 1));
$server['playersmax'] = ord(substr($inner, 3, 1));
$server['password'] = ord(substr($inner, 7, 1));
$server['vac'] = ord(substr($inner, 8, 1));
var_dump( $server );
echo $packet[4];
?>
[/CODE]
mmm got it ! now i need to look if i can found an "how to" XD
thw for help me to drop the first part.
I'm back...sorry.
After a wheel, i don' found an exemple or a guide to learn... I'm realy stuck and i need a little "hey! listen!".
Someone know a thread like [url]https://facepunch.com/showthread.php?t=1234005[/url] but for bromsock?
Or have an exemple to get server name ? (i w'll extrapolate them to test and perform other querry).
Thx a lote =X
[QUOTE=Nyhu;51995115]I'm back...sorry.
After a wheel, i don' found an exemple or a guide to learn... I'm realy stuck and i need a little "hey! listen!".
Someone know a thread like [url]https://facepunch.com/showthread.php?t=1234005[/url] but for bromsock?
Or have an exemple to get server name ? (i w'll extrapolate them to test and perform other querry).
Thx a lote =X[/QUOTE]
Just mess with it, see how it works.
[QUOTE=Nyhu;51995115]I'm back...sorry.
After a wheel, i don' found an exemple or a guide to learn... I'm realy stuck and i need a little "hey! listen!".
Someone know a thread like [url]https://facepunch.com/showthread.php?t=1234005[/url] but for bromsock?
Or have an exemple to get server name ? (i w'll extrapolate them to test and perform other querry).
Thx a lote =X[/QUOTE]
Did you look at the official Bromsock thread? [url]https://facepunch.com/showthread.php?t=1393640[/url]
He made several examples already, if you didn't notice them when Rocket linked the Github repo: [url]https://github.com/Bromvlieg/gm_bromsock/tree/master/Lua_examples[/url]
Sorry, you need to Log In to post a reply to this thread.