#20894 [Ver]: Problem using socket
| From: | edink@php.net | Date: | Mon, 09 Dec 2002 11:08:07 +0000 |
| Subject: | #20894 [Ver]: Problem using socket | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-27150@lists.php.net to get a copy of this message | ||
ID: 20894
Updated by: edink@php.net
Reported By: okwoks@yahoo.com
Status: Verified
Bug Type: Sockets related
Operating System: Win XP
PHP Version: 4.3.0RC2
New Comment:
Some more info:
When compiled in debug mode MS VC++ comes with the following debug
error:
"The value of ESP was not properly saved across a function call. This
is usually a result of calling a function declared with one calling
convention with a function pointer declared with a different calling
convention".
The error occurs in ext/sockets/sockets.c line 792.
Previous Comments:
------------------------------------------------------------------------
[2002-12-09 04:44:36] edink@php.net
The example that does not depend on custom apps:
$socket = socket_create (AF_INET, SOCK_STREAM, 0);
if ($socket < 0) {
echo "socket_create() failed: reason: " .
socket_strerror ($socket) . "\n";
}
$result = socket_connect ($socket, "www.google.com", 80);
if ($result < 0) {
echo "socket_connect() failed.\nReason: ($result) ".
socket_strerror($result) . "\n";}
$command = "HEAD / HTTP/1.0\r\n\r\n";
socket_write ($socket, $command, strlen($command));
while($data == ""){
if (!($data = socket_read ($socket, 2048))) die("Socket disconnected
by the host.");
}
echo $data;
socket_close($socket);
------------------------------------------------------------------------
[2002-12-09 02:14:30] okwoks@yahoo.com
Hi,
I'm doing an web application which connects to a delphi app by using
sockets to transmit data. My delphi program will reply automatically
when it receive a data. However, after i upgraded to PHP 4.3.0RC2, it
doesn't work and came out this error-
PHP has encountered an Access Violation at 00000001
Below here are my codes that use to connect to the delphi program.
$add="180.10.0.1"; //ST8000 machine's ip address
$port="5000";
$rc_no=50;
global $chr;
$chr = "";
$changes=0;
$data = "";
$socket = socket_create (AF_INET, SOCK_STREAM, 0);
if ($socket < 0) { echo "socket_create() failed: reason: " .
socket_strerror ($socket) . "\n"; }
@$result = socket_connect ($socket, $add, $port);
if ($result < 0) { echo "socket_connect() failed.\nReason: ($result) "
. socket_strerror($result) . "\n";}
$Command = "..... data use to send to delphi......"
socket_write ($socket, $Command, strlen ($Command));
//----------starting from this line where the error occur
While($data == ""){
If (!($data = socket_read ($socket, 2048))) die("Socket disconnected by
the host.");
}
echo $data;
socket_close($socket);
The code had no problem since it can be run on PHP 4.2.3, Win XP, mysql
------------------------------------------------------------------------
[2002-12-08 22:42:37] sniper@php.net
Not enough information was provided for us to be able
to handle this bug. Please re-read the instructions at
http://bugs.php.net/how-to-report.php
If you can provide more information, feel free to add it
to this bug and change the status back to "Open".
Thank you for your interest in PHP.
------------------------------------------------------------------------
[2002-12-08 22:21:29] okwoks@yahoo.com
I use socket to develope my web application. It works fine when i'm
using PHP 4.2.2. The problem is when i ugraded it to 4.3.0RC2, there's
an error stating -
PHP has encountered an Access Violation at 017C29CD
Does PHP 4.3.0RC2 have a stable socket dll?
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=20894&edit=1