|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
[2006-08-23 15:04 UTC] pierre-marie dot mouliere at arc-intl dot com
Description:
------------
Symptom :
When opening a socket with fsockopen() the following error occurs : fsockopen(): unable to connect to x.x.x.net:80 (Operation now in progress) in testsocket.php
We locate the problem in the source code
Problem is in network.c, in 'main' directory, near line 328
Function getsockopt() returns code EINPROGRESS in 'error' field. So function exits with ret = -1 (third line from end here), although EINPROGRESS is not really an error.
We have implemented the following workaround (3 lines) between /* Start changes */ and /* End changes */ and it's fixed
Reproduce code:
---------------
----------------------------------------------------------
ok:
if (!asynchronous) {
/* back to blocking mode */
RESTORE_SOCKET_BLOCKING_MODE(sockfd, orig_flags);
}
/* Start changes */
if (error == EINPROGRESS) {
error = 0;
}
/* End changes */
if (error_code) {
*error_code = error;
}
if (error && error_string) {
*error_string = php_socket_strerror(error, NULL, 0);
ret = -1;
}
return ret;
----------------------------------------------------------
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
|
|||||||||||||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Sat Oct 25 16:00:02 2025 UTC |
Hello, It's difficult to give more information. The php source code to test is <?php $sk = fsockopen("dev2.emea.dmai.net",80); echo "socket = " . $sk; ?> May be the problem in only on HPUX. We found a solution to fixed it. It's running and for us it's OK now. But we prefer to include our sources change of network.c in the global release. If not, we need to change source code at each releases. Best regards Pierre Marie MOULIEREYou are right, But I think that this update will be ok for all others systems because the error EINPROGRESS is not a real error after the getsockopt() function (no block mode) It's seen that the open socket is still in progress when the getsockopt() function is call. We look for HP support and we found no patches and no information about this the getsockopt() return code is OK To detect it we use TUSC Tools ------- socket(AF_INET, SOCK_STREAM, 0) .......................... = 3 fcntl(3, F_GETFL, 0) ..................................... = 2 fcntl(3, F_SETFL, 65538) ................................. = 0 connect(3, 0x60000000002ead58, 16) ....................... ERR#245 EINPROGRESS poll(0x9fffffffffffce38, 1, 60000) ....................... = 1 getsockopt(3, SOL_SOCKET, SO_ERROR, 0x9fffffffffffce30, 0x9fffffffffffce40) = 0 fcntl(3, F_SETFL, 2) ..................................... = 0 open("/usr/lib/nls/msg/C/strerror.cat", O_RDONLY|0x800, 0113572) = 4 -------