[Haskell-cafe] non-blocking recv from UDP socket

Brandon S Allbery KF8NH allbery at ece.cmu.edu
Thu Aug 26 12:46:54 EDT 2010


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On 8/26/10 05:13 , Vo Minh Thu wrote:
> Is is possible to get Network.Socket.ByteString.recv to be
> non-blocking (i.e. return directly even if no data is available) ?

"What are you really trying to do?"

The Haskelly solution to this is to use threads; let the thread reading the
socket block and the main thread synchronize with it somehow.  (Haskell
threads are very inexpensive; don't be afraid of them.)

- -- 
brandon s. allbery     [linux,solaris,freebsd,perl]      allbery at kf8nh.com
system administrator  [openafs,heimdal,too many hats]  allbery at ece.cmu.edu
electrical and computer engineering, carnegie mellon university      KF8NH
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2.0.10 (Darwin)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iEYEARECAAYFAkx2mn4ACgkQIn7hlCsL25U2fQCgjHzzO3f61z7GeyVZfJIaet7k
vE4An1CaiqTke6BdpuvYsg5U0d+n3Ig7
=QcGa
-----END PGP SIGNATURE-----


More information about the Haskell-Cafe mailing list