#33629 [Opn->Bgs]: Limitation whit UDP socks
| From: | wez@php.net | Date: | Sun, 10 Jul 2005 14:32:25 +0000 |
| Subject: | #33629 [Opn->Bgs]: Limitation whit UDP socks | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-81633@lists.php.net to get a copy of this message | ||
ID: 33629
Updated by: wez@php.net
Reported By: Whachucallme at gmail dot com
-Status: Open
+Status: Bogus
Bug Type: Feature/Change Request
Operating System: any
PHP Version: 5CVS-2005-07-10 (dev)
New Comment:
Sorry, but your problem does not imply a bug in PHP itself. For a
list of more appropriate places to ask for help using PHP, please
visit http://www.php.net/support.php as this bug system
is not the
appropriate forum for asking support questions. Due to the volume
of reports we can not explain in detail here why your report is not
a bug. The support channels will be able to provide an explanation
for you.
Thank you for your interest in PHP.
Please ask support questions elsewhere.
Previous Comments:
------------------------------------------------------------------------
[2005-07-10 11:44:04] Whachucallme at gmail dot com
Description:
------------
I am translating a MIRC script to a PHP script and almost at the end i
noticed after 3days of chatting on #php (quakenet) and searching Google
that it isn't possible.
At line 169 of the MIRC script u can see:
sockudp -k rcon 7130 %rcon.ip %rcon.port ÿÿÿÿrcon %rcon.challengenumber
" $+ %rcon.password $+ " logaddress_add %rcon.myip 7130
when i look at the help file of MIRC under sockudp i find:
UDP is a connection-less protocol, ie. you can send information via UDP
to other UDP addresses without needing to connect to them first.
UDP does not guarantee that any information you send will actually
reach it's destination, ie. it isn't a reliable protocol. Also, be
aware that UDP packets may not arrive in the same order as that in
which they were sent. This means that you must perform your own
checking to confirm that any data you sent actually reached it's
destination properly.
/sockudp [-bntkd] [bindip] <name> [port] <ipaddress> <port> [numbytes]
[text|%var|&binvar]
If you specify the -t switch, it forces mIRC to send anything beginning
with a & as normal text instead of interpreting it as a binary variable.
The -n switch appends a $crlf to the line being sent if it's not a
&binvar and if it doesn't already have a $crlf.
The -b switch indicates that you are specifying the numbytes value
which is the number of bytes you want sent.
The -k switch forces the socket to stay open, this allows it to listen
for data that is sent to its port via UDP. If -k is not specified, the
socket is opened, the information is sent to the specified ipaddress
and port, and the socket is then closed.
The -d switch means that you specified an ip address as the bind
address.
If you specify a socket name that doesn't exist, it is created. If it
does exist, the existing socket is used to send the info.
You can also specify the local port number that you wish to use, if it
isn't specified, mIRC chooses one randomly.
ipaddress and port specify the destination address to which you want to
send information. You can only use an IP address here.
On error: if a /sockudp fails, it sets $sock().wserr to the error
value, and triggers the on sockwrite event with $sockerr set.
on 1:udpread:name:commands
The udpread event is triggered when there is info waiting to be read on
a UDP socket. You can read this info using the /sockread command.
Note: If this event triggers but no /sockread is performed to attempt
to read the buffer, it is assumed that no script exists that is
handling this buffer, so it is cleared and the info it contained is
lost.
please note that there are 2 ports used here 7130 and %rcon.port there
just isn't a way in php to get the same effect. No-one on #php found
the sollution and nothing on Google.
Making a PHP matchbot has never been done because it just isn't
possible in php to make the connection needed for it.
Reproduce code:
---------------
The IRC script is at
http://www.mircscripte.de/dl/scripts.php?cid=2&id=34
What doesn't work is:
$cmd = "ÿÿÿÿrcon ". $settings['challenge'] ." \"".
$settings['rcon']
."\" logaddress_add ". $settings['myip'] ." 13";
if (!$cssocket=fsockopen("udp://".$host .":". $port,7130,$errnr)) {
$errmsg="No connection";
return "";
}
socket_set_blocking($cssocket,true);
fwrite($cssocket,$cmd,strlen($cmd));
while (!feof($cssocket)) {
echo fgets($cssocket);
}
fclose($cssocket);
Expected result:
----------------
If this would work i would get the log from a Half-life based server
Actual result:
--------------
Timeout
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=33629&edit=1