ID: 36354
Updated by: [EMAIL PROTECTED]
Reported By: psychi at freakmail dot de
-Status: Open
+Status: Bogus
Bug Type: Sockets related
Operating System: Linux 2.6.14.5
PHP Version: 5.1.2
New Comment:
socket_create(AF_INET, SOCK_RAW, SOL_UDP);
Previous Comments:
------------------------------------------------------------------------
[2006-02-27 02:48:06] reply at here dot org
The same problem with other code, used fsockopen:
<?PHP
$connection=fsockopen("login.icq.com", 5190);
$socket_data=fread($connection, 10);
echo "-> ".strlen($socket_data)."<br>"; flush();
fwrite($connection,
"\x2A\x01\x00\x02\x00\x11\x00\x00\x00\x01\x00\x01\x00\x09\x01\x01\x01\x01\x01\x01\x01\x01\x01");
$socket_data=fread($connection, 1);
echo "-> ".strlen($socket_data); flush();
?>
*?*
------------------------------------------------------------------------
[2006-02-23 01:52:31] martin dot fox at gmx dot com
I achieved the same problem with the same version and the same OS and
don't know why this happens, but I think some time ago it worked for
me! But I can't remember what I've changed that it does not work now. I
really would appreciate a solution for that, the acceptance as bug or
some official reaction.
------------------------------------------------------------------------
[2006-02-10 15:24:13] psychi at freakmail dot de
Description:
------------
Hello.
I tried to write a small icq client and connected to the icq server,
received the hello packet (10 bytes, as you can see in the example) and
sent a packet to the icq server (23 bytes) back. The problem is that the
next call of socket_read() returns "unable to read from socket [104]:
Connection reset by peer". This message generally is ok, because icq
closes the connection - but there should be still waiting data for me
(see Commview Log).
Where did "Paket #3" go? I can't read it with PHP, but i don't know why
- but it should by somewhere... in my opinion. Tried this also with PHP
5.0.5 with same result... hope this is enough information.
- Thanks -
Commview Log (produced by given code)
Paket #1
0x0000 2A 01 B5 D2 00 04 00 00-00 01 *.µÒ......
Paket #2
0x0000 2A 01 00 02 00 11 00 00-00 01 00 01 00 09 01 01
*...............
0x0010 01 01 01 01 01 01 01 .......
Paket #3
0x0000 2A 04 B5 D3 00 3A 00 01-00 09 01 01 01 01 01 01
*.µÓ.:..........
0x0010 01 01 01 00 04 00 23 68-74 74 70 3A 2F 2F 77 77
......#http://ww
0x0020 77 2E 61 6F 6C 2E 63 6F-6D 3F 63 63 6F 64 65 3D
w.aol.com?ccode=
0x0030 75 73 26 6C 61 6E 67 3D-65 6E 00 08 00 02 00 04
us&lang=en......
Reproduce code:
---------------
<?PHP
socket_clear_error();
$connection=socket_create(AF_INET, SOCK_STREAM, SOL_TCP);
socket_connect($connection, gethostbyname("login.icq.com"), 5190);
$socket_data=socket_read($connection, 10, PHP_BINARY_READ);
echo "-> ".strlen($socket_data)."<br>"; flush();
socket_write($connection,
"\x2A\x01\x00\x02\x00\x11\x00\x00\x00\x01\x00\x01\x00\x09\x01\x01\x01\x01\x01\x01\x01\x01\x01");
$socket_data=socket_read($connection, 1, PHP_BINARY_READ);
echo "-> ".strlen($socket_data)."<br>"; flush();
?>
Expected result:
----------------
-> 10
-> 1
Actual result:
--------------
-> 10
Warning: socket_read() [function.socket-read]: unable to read from
socket [104]: Connection reset by peer in /home/html/icq.php5 on line
11
-> 0
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=36354&edit=1