With older versions of the
network library (version 2.6.0.2
or earlier) on Windows operating systems, the networking subsystem
must be initialised using
withSocketsDo before any networking
operations can be used. eg.
main = withSocketsDo $ do {...}
It is fine to nest calls to
withSocketsDo, and to perform
networking operations after
withSocketsDo has returned.
withSocketsDo is not necessary for the current network library.
However, for compatibility with older versions on Windows, it is good
practice to always call
withSocketsDo (it's very cheap).