473,322 Members | 1,734 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,322 software developers and data experts.

stream_socket_client doesn't work???

I'm using PHP 5.0 on Windows XP, and I'm trying to use
stream_socket_client to attach to an SSL socket server. Something like
this:

$host = "localhost";
$port = 9999;

$context = stream_context_create();
stream_context_set_option($context, 'ssl', 'local_cert', 'mycert.pem');
stream_context_set_option($context, 'ssl', 'passphrase', 'secret');

$where = "ssl://$host:$port";

$s = stream_socket_client($where, $errno, $errstr, 30, 0, $context);

var_dump($s);

This code runs. $s reports to be a stream resource, nothing is placed
in $errno or $errstr.

But it doesn't make a connection to the server. I know for certain
because I have a breakpoint in the server at "accept" (it's in C++)
that doesn't get hit.

Now, I've been single-stepping thru PHP's source code to see what I
might be missing. What I haven't stepped into yet is anything that
actually connects a socket to a server. It looks rather like that
should happen in php_openssl_ssl_socket_factory (a function in
xp_ssl.c) but it's not there.

Does stream_socket_client truly not work? I need to connect to an SSL
server and send a local certificate, which fsockopen (apparently)
doesn't allow.

Jul 17 '05 #1
1 5063
Nobody helps. I find the answer myself. Typical.

You have to supply the value STREAM_CLIENT_CONNECT for the 'flags'
parameter of the call to stream_client_socket (I had zero because the
two flags noted didn't apply to me). I found that out while stepping
thru the source code of transports.c.

Apparently stream_socket_client isn't ready for prime time yet; in the
documentation it's still labelled EXPERIMENTAL, and it doesn't explain
the STREAM_CLIENT_CONNECT requirement.

Jul 17 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
by: bof | last post by:
When attempting to use stream_socket_client() the error message "Fatal error: Call to undefined function" is returned. Any suggestions as to where to start looking to resolve this? MTIA, if...
7
by: AnnMarie | last post by:
My JavaScript Form Validation doesn't work at all in Netscape, but it works fine in IE. I made some of the suggested changes which enabled it to work in IE. I couldn't make all the changes...
39
by: Mark Johnson | last post by:
It doesn't seem possible. But would the following also seem a violation of the general notions behind css? You have a DIV, say asociated with class, 'topdiv'. Inside of that you have an anchor...
149
by: Christopher Benson-Manica | last post by:
(Followups set to comp.std.c. Apologies if the crosspost is unwelcome.) strchr() is to strrchr() as strstr() is to strrstr(), but strrstr() isn't part of the standard. Why not? --...
6
by: A.M-SG | last post by:
Hi, I have an aspx page at the web server that provides PDF documents for smart client applications. Here is the code in aspx page that defines content type: Response.ContentType =...
4
by: bbp | last post by:
Hello, In an ASPX page I have a "Quit" button which make a simple redirect in code-behind. This button doesn't work no more since (I think) I moved from the framework 1.0 to 1.1 and it doesn't...
10
by: Sourcerer | last post by:
I wrote this very simple code in .NET VC++. I compiled it on my system, and tried to run it on my friend's computer (he doesn't have the compiler). We both have Windows XP Professional. I have .NET...
39
by: alex | last post by:
I've converted a latin1 database I have to utf8. The process has been: # mysqldump -u root -p --default-character-set=latin1 -c --insert-ignore --skip-set-charset mydb mydb.sql # iconv -f...
5
by: mike.coakley | last post by:
Does stream_socket_client use the /etc/hosts file? I'm using Mac OSX 10.5.3 as a development platform and VMware Fusion for VM hosting. I have a OpenSUSE Linux VM that has an Apache 2 web server...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.