|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
[2006-02-10 15:24 UTC] 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 PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
|
|||||||||||||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Thu Dec 04 17:00:01 2025 UTC |
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(); ?> *?*