[Haskell-cafe] TLS package server interface do not seem to allow for asyncrhonious communication

Mads Lindstrøm mads.lindstroem at gmail.com
Tue Dec 14 21:21:48 CET 2010


Hi Haskeleers,

I got a working SSL server using the TLS package. Great. However, I
really intended to use SSL for an asynchronous server. That is, the
server must constantly listen for a client message, which may result in
zero or more messages send _to_ the client. And the server will, without
being waken up by a client message, send messages to the client.

And this interface
http://hackage.haskell.org/packages/archive/tls/0.3.1/doc/html/Network-TLS-Server.html do not seem to allow for an asynchronous server. That is, whenever I call:

recvPacket :: Handle -> TLSServer IO (Either TLSError [Packet])

or

recvData :: Handle -> TLSServer IO ByteString

The server is stuck until the client sends a message. Or am I missing
something?

Contrast this to Network package socket implementation. Here I can spawn
two threads and simultaneously listen for client messages and send
messages to the client.

It seems to me that a general SSL implementation should not preclude
asynchronous servers. I know, the TLS package is not more than a few
months old and one can already use it for SSL servers and clients, which
is quite impressive. So do not read this as a negative comment, more as
suggestions for a better interface.



Regards,

Mads Lindstrøm





More information about the Haskell-Cafe mailing list