select + ssl

Donn Cave donn at u.washington.edu
Wed Feb 23 17:54:12 EST 2005


In article <cvilj2$p8u$1 at aphrodite.grec.isp.9tel.net>,
 Ktm <ktm-void at altern.org> wrote:

> I don't have the same behaviour with two codes who are quite the same,
> one using SSL, the other not. I tested the programs with stunnel and
> telnet , respectively.

[... program source ...]

> The server blocks on recv here.

SSL is a layer on top of the socket.  It reads and writes
SSL protocol data on the socket connection, while its
recv() and send() methods return and accept the unencrypted
protocol payload (you already knew this.)

The select() function does not however deal with this layer,
it looks directly at the socket.  It's telling you that recv()
won't block -- but it means the recv(2) that SSL uses, not
the SSL.Connection.recv() that you have to use.

> In both case I don't send anything with the client. (Perhaps stunnel
> send something that I don't see ?)
> 
> Why does the server block ?

Probably you're seeing the initial exchange of data during
the SSL connection - certificates and so forth.  You may
find that after this is done, further exchanges will work
OK with select().  Or maybe not -- I really don't know enough
about SSL to predict this.

   Donn Cave, donn at u.washington.edu



More information about the Python-list mailing list