php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #15040 Socket
Submitted: 2002-01-15 03:43 UTC Modified: 2002-06-12 12:28 UTC
Votes:2
Avg. Score:4.0 ± 0.0
Reproduced:2 of 2 (100.0%)
Same Version:0 (0.0%)
Same OS:0 (0.0%)
From: webmaster at weathermetrics dot com Assigned:
Status: Closed Package: Sockets related
PHP Version: 4.1.1 OS: Windows NT 4.0
Private report: No CVE-ID: None
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: webmaster at weathermetrics dot com
New email:
PHP Version: OS:

 

 [2002-01-15 03:43 UTC] webmaster at weathermetrics dot com
I keep getting the following error:
"Microsoft Visual Basic Run-time error '10054': THe connection is reset by remote side"
when I try to connect a PHP UDP socket to a VB Application.  I am trying to dump a small packet of data to the VB program using the following PHP code:
        $port=getPort($t);
        $host=getHost($t);
        $prot=getProtocol($t);
        $fp = fsockopen ($prot.$host, $port, $errno, $errstr, 30);
        if (!$fp) {
            echo "$errstr ($errno)<br>\n";
        } else {
            $w=fputs ($fp, URLUnEncode($Commands["DATA"]));
        }
    }
    if (!$fp)
    {
        //$w=socket_set_blocking(TRUE);
        //sleep(30);
        $w = fclose ($fp);
    }
The problem is the socket works fine the first time, but the second time the script is run (~1 min between successive runs) the application gives this error.  It seems to me the script is closing before it is done sending the data.  I tried various socket timeouts, setting the blocking to true and false, and putting a pause in.  Nothing seemed to work.  Is it because only the script is sending data, I have not seen any PHP examples, where the script is the only side sending data.
Thanks,
Eric Levy

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2002-01-15 07:18 UTC] sander@php.net
Are you sure this is a problem with PHP and not with Visual Basic???
 [2002-01-15 11:20 UTC] webmaster at weathermetrics dot com
I'm sorry I should have made this clear.  This was a pre-existing VB App that I have been running for a year now doing the same procedure from embedded clients.  It is a possibility I am not fully understanding the life of a PHP socket vs. other socket types.  Does anyone have any documentation on the life of a PHP socket.  It seems to me like the socket is dyeing before sending the message.
Thanks,
Eric Levy
 [2002-01-15 13:28 UTC] webmaster at weathermetrics dot com
I added $w=fflush($fp); after sending the line $w=fputs ($fp, URLUnEncode($Commands["DATA"]));

 [2002-01-15 14:26 UTC] webmaster at weathermetrics dot com
It didn't get the second half of my last statement, the fflush DIDN'T work either.  This is still an ongoing problem.
Thanks,
Eric Levy
 [2002-01-15 14:38 UTC] webmaster at weathermetrics dot com
Ok, here's what MS has to say about what causes that error:
WSAECONNRESET (10054) 
Connection reset by peer. 
An existing connection was forcibly closed by the remote host. This normally results if the peer application on the remote host is suddenly stopped, the host is rebooted, or the remote host uses a hard close (see setsockopt for more information on the SO_LINGER option on the remote socket.) This error may also result if a connection was broken due to keep-alive activity detecting a failure while one or more operations are in progress. Operations that were in progress fail with WSAENETRESET. Subsequent operations fail with WSAECONNRESET. 
This is what I thought was happening, but why does my script end before my program has time to process it.  I should make note that I have one script opening a page with a php script on another webserver and this script is the one that is having problems opening the UDP connection.  Could this have anything to do with it.
 [2002-05-11 18:51 UTC] mfischer@php.net
There have been quite some changes to the sockets extension lately. Please test the upcomming 4.2.1 going to be released in a few days (or test CVS HEAD).
 [2002-06-12 01:00 UTC] php-bugs at lists dot php dot net
No feedback was provided for this bug for over a month, so it is
being suspended automatically. If you are able to provide the
information that was originally requested, please do so and change
the status of the bug back to "Open".
 [2002-06-12 12:28 UTC] mfischer@php.net
User reported privately that it worked in 4.2.1, closing.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sat Dec 21 18:01:29 2024 UTC