[stunnel-users] behaviour on remote disconnection

Brian Hatch bri at stunnel.org
Tue Mar 11 14:04:43 CET 2008

At practically 2008-03-11 12:13 +0100, Marek Jarycki articulated:

> I'm using 3.26 version of stunnel. How to disallow creating local sockets
> (on client side) when remote (server) is not available? My application
> detects socket creation errors and it works without stunnel, but in stunnel
> the socket is always opening correctly so I have to wait for timeouts to
> discover network disconnection.

Stunnel is sitting in accept(2) waiting for a peer to connect.  accept
is a kernel system call, and it doesn't have the ability to do something
like "let me know when a connection could be ready so I can verify if
I can connect to my remote side before you do the actual accept".  If
you'r in accept, you will get your first chance to do anything after
the TCP handshake is done.

You need to adjust your code to deal with the fact that stunnel may
be there, but the service to which stunnel is connecting you isn't.

Also, upgrade to Stunnel v4.

Brian Hatch                  It takes 43 muscles to
   Systems and                frown, and 17 to smile,
   Security Engineer          but it doesn't take any
http://www.ifokr.org/bri/     to just sit there with a
                              dumb look on your face.
Every message PGP signed
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 189 bytes
Desc: Digital signature
URL: <http://www.stunnel.org/pipermail/stunnel-users/attachments/20080311/85535b7c/attachment.sig>

More information about the stunnel-users mailing list