Unable to push notifications to iPhone in .NET - .PEM certificate problem?

Unable to push notifications to iPhone in .NET - .PEM certificate problem?

I'm attempting to push notifications to my iPhone, which I've successfully done using PHP. However, I'm unable to open a socket connection to Apple's push servers using C#. I don't think there's a problem with the certificate itself, since I'm able to successfully push notifications using this code in PHP:

$ctx = stream_context_create();  stream_context_set_option($ctx, 'ssl', 'local_cert', 'cert.pem');  $fp = stream_socket_client('ssl://gateway.push.apple.com:2195', $err, $errstr, 60, STREAM_CLIENT_CONNECT, $ctx);  fwrite($fp, $msg); 

When I try to authenticate in C# using the code below, Apple closes the connection right away. I get this exception: "Unable to read data from the transport connection: An existing connection was forcibly closed by the remote host."

sslStream.AuthenticateAsClient(hostname, certificatesCollection, SslProtocols.Default, false); 

I basically took all my code from this question: http://stackoverflow.com/questions/1056083/c-iphone-push-server

I thought it might be a problem with the certificate since I don't think C# allows you to just load .PEM files programmatically. I used OpenSSL to convert it to a .PFX file, but I still have the same problem.

Any idea how I can troubleshoot this (possible certificate) problem?

How to ALTER sqlite column (iPhone)?


How to escape characters in href=mailto (iPhone)
This actually turned out to be a problem with .NET 2.0.

iPhone SDK: UIWebView
Not sure exactly what it is, but I compiled in Visual Studio 2008 and everything worked great..
Focus OnLoad=“document.form_id.form_field_id.focus();” on the iPhone

Getting access to touchesBegan/Moved/Ended to a UITableViewCell

82 out of 100 based on 52 user ratings 802 reviews