php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #20894 Problem using socket
Submitted: 2002-12-08 22:21 UTC Modified: 2002-12-09 07:31 UTC
From: okwoks at yahoo dot com Assigned:
Status: Closed Package: Sockets related
PHP Version: 4.3.0RC2 OS: Win XP
Private report: No CVE-ID: None
 [2002-12-08 22:21 UTC] okwoks at yahoo dot 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?

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2002-12-08 22:42 UTC] 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-09 02:14 UTC] okwoks at yahoo dot 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-09 04:44 UTC] 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 05:08 UTC] edink@php.net
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.
 [2002-12-09 07:31 UTC] edink@php.net
This bug has been fixed in CVS.

In case this was a PHP problem, snapshots of the sources are packaged
every three hours; this change will be in the next snapshot. You can
grab the snapshot at http://snaps.php.net/.
 
In case this was a documentation problem, the fix will show up soon at
http://www.php.net/manual/.

In case this was a PHP.net website problem, the change will show
up on the PHP.net site and on the mirror sites in short time.
 
Thank you for the report, and for helping us make PHP better.


 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Mon Dec 02 17:01:35 2024 UTC