I have a thread in which I want to use an SSLsocket to connect to a host. I use a thread so I can suspend the thread and then resume it from one or other event handler. Sample code looks like this:
[code] socket = new SSLSocket
socket.Address = “host.example.com”
socket.Port = xxx
socket.secure = true
socket.ConnectionType = SSLSocket.SSLv3
Addhandler socket.Error, WeakAddressOf errorEvent
Addhandler socket.Connected, WeakAddressOf connectedEvent
AddHandler socket.DataAvailable, WeakAddressOf gotdataEvent
socket.connect ()
app.threadPtr.Suspend ()
// check here why we were resumed
[/code]
What actually happens is that the connection does not occur; instead I get a 102 error (seen by putting a breakpoint after the suspend()
to see what actually happened). Note that:
-
Connecting to this host works fine using SSLv3 in another application (actually the one I’m trying to port to Xojo)
-
If I try the above and have
socket.secure = false
(i.e. no SSL, just a TCP connect) then the connection is made OK -
If I replace my suspend/resume scheme and instead poll the socket after trying to connect, as shown in documentation examples, then the SSL connection is made OK
So - is there any bad interaction between trying to connect via SSL to a host and suspending the thread doing the connect?