Need help getting StreamSocket.upgradeToSslAsync working
-
Tuesday, August 07, 2012 7:21 PM
I'm trying to write some test code to confirm a few pieces of upgradeToSslAsync's behavior. The finalized code wouldn't look like this but here is my test code:
var sock = new Windows.Networking.Sockets.StreamSocket(); sock.connectAsync(new Windows.Networking.HostName("10.116.32.101"), "443", Windows.Networking.Sockets.SocketProtectionLevel.plainSocket).then( function success() { sock.upgradeToSslAsync(Windows.Networking.Sockets.SocketProtectionLevel.ssl, new Windows.Networking.Sockets.HostName("broker.testdomain.int")).then( function success() { // Blah }, function error(reason) { // Blah }); }, function error(reason) { // Blah });When I run that code, the upgradeToSslAsync call immediately throws an exception saying "Object doesn't support this action". Is that a notification from the socket that the server side does not support upgrade to SSL or is there a different issue in my code that I'm not noticing?
All Replies
-
Wednesday, August 08, 2012 3:54 PMModerator
Hi Adam,
The debugger is your friend! If you break on that function and inspect your variables, you will see "Windows.Networking.Sockets" does not have a member "HostName". You want to change your code per the documentation to this:
sock.upgradeToSslAsync(Windows.Networking.Sockets.SocketProtectionLevel.ssl,
newWindows.Networking.HostName("jsanders4")).then(
Jeff Sanders (MSFT)
- Marked As Answer by Jeff SandersMicrosoft Employee, Moderator Wednesday, August 08, 2012 3:54 PM
-
Wednesday, August 08, 2012 4:02 PMAh, yeah you're right, thanks!


