php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #47292 I can not read the socket answer
Submitted: 2009-02-03 16:35 UTC Modified: 2009-02-04 19:00 UTC
From: bbarnett at gt dot co dot cr Assigned:
Status: Not a bug Package: Sockets related
PHP Version: 5.2.8 OS: Windows 2003 Server R2
Private report: No CVE-ID: None
 [2009-02-03 16:35 UTC] bbarnett at gt dot co dot cr
Description:
------------
I'm trying to read the answer of a socket after I wrote the information that I must send before, but the application freeze and don't send me any message.

I'm monitoring the port using TCPVIEWER and I can see while the conection is established.

Using CLARION 6 I don't have any problem comunicating with the socket (writing and reading) my  problem is only with PHP.

I don't now if this is a bug, but after read many information about how to use the socket I'm giving up.

Please, I need your help because we're developing a new software that comunicate with many socket's server to pay public services in my country and in actualy we are using Clarion 6, but with this environment we don't have enough support.

Reproduce code:
---------------
$puerto_servicio = 3260;$direccion = '172.25.10.5';
$socket = socket_create(AF_INET, SOCK_STREAM, SOL_TCP);
if ($socket === false) {echo "socket_create() fall?: motivo: " . socket_strerror(socket_last_error()) . "<br>"; die();
} else {echo "OK.<br>";}
$resultado = socket_connect($socket, $direccion, $puerto_servicio);
if ($resultado === false) {
    echo "socket_connect() fall?.<br>Motivo: ($resultado) " .
         socket_strerror(socket_last_error($socket)) . "<br>";
} else {echo "OK.<br>";}
$entrada=$trama800; $salida = '';
if (!socket_write($socket, $entrada, strlen($entrada))) {
	echo "socket_connect() fall?.<br>Motivo: ($resultado) " .
         socket_strerror(socket_last_error($socket)) . "<br>";}
if (!$salida = socket_read($socket, 426)) {
	echo "socket_connect() fall? en lectura.<br>Motivo: ($resultado) " .
         socket_strerror(socket_last_error($socket)) . "<br>";}
socket_close($socket);

Expected result:
----------------
I wait to recieve a string with 426 chars

Actual result:
--------------
frezze the browser

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2009-02-03 22:12 UTC] jani@php.net
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.


 [2009-02-04 19:00 UTC] bbarnett at gt dot co dot cr
Thank you for your answer, but I need some tip, because a wrote my request in many forums but nobody answer me about how to resolve it.

You are my last option to ask.

Thank's
 
PHP Copyright © 2001-2022 The PHP Group
All rights reserved.
Last updated: Mon Jan 24 21:03:34 2022 UTC