socket: An extensible socket library.

[ library, mit, network, system ] [ Propose Tags ]

This library is a minimal cross platform interface for BSD style networking.


[Skip to Readme]
Versions 0.1.0.0, 0.1.0.1, 0.2.0.0, 0.3.0.1, 0.4.0.0, 0.4.0.1, 0.5.0.0, 0.5.1.0, 0.5.2.0, 0.5.3.0, 0.5.3.1, 0.6.0.0, 0.6.0.1, 0.6.1.0, 0.6.2.0, 0.7.0.0, 0.8.0.0, 0.8.0.1, 0.8.1.0 (info)
Change log CHANGELOG.md
Dependencies base (>=4.7 && <5), bytestring (<0.11) [details]
License MIT
Author Lars Petersen
Maintainer info@lars-petersen.net
Category System, Network
Home page https://github.com/lpeterse/haskell-socket
Bug tracker https://github.com/lpeterse/haskell-socket/issues
Source repo head: git clone git://github.com/lpeterse/haskell-socket.git
Uploaded by LarsPetersen at Sun Apr 10 08:53:16 UTC 2016
Distributions NixOS:0.8.1.0
Downloads 6440 total (45 in the last 30 days)
Rating 2.0 (votes: 1) [estimated by rule of succession]
Your Rating
  • λ
  • λ
  • λ
Status Docs available [build log]
Last success reported on 2016-04-10 [all 1 reports]
Hackage Matrix CI

Modules

[Index]

Downloads

Maintainer's Corner

For package maintainers and hackage trustees


Readme for socket-0.6.0.1

[back to package description]

socket

Available on Hackage License MIT Build Status

Motivation

This library aims to expose a minimal and cross platform interface for POSIX compliant networking code.

Implementation Philosophy

  • Every operation and every flag exposed should be supported with same semantics on every platform. If this cannot be guaranteed it should be supplied by another (extension) package.

  • Absolutely no conditional exports.

  • No #ifdef madness in the Haskell sources. The Haskell binding code uses the FFI to reference the platform's native networking functions. If they are not POSIX compliant (i.e. on Windows) a level of indirection is introduced to create a POSIX compliant equivalent in C using whatever the platform specific building blocks are.

Platform Support

Linux

Working.

MacOS

Working.

Windows

Fully supported on Windows7 (maybe Vista) or higher :-)

GHC's runtime system on Windows does not offer an event notification mechanism for sockets. The original network library suffers from this, too. For example, connection attempts are non-interruptible etc. The approach taken to circumvent this in this library is to poll the non-blocking sockets with increasing delay. This guarantees non-interruptability and fairness between different threads. It allows for decent throughput while also keeping CPU consumption on a moderate level if a socket has not seen events for a longer period of time (maximum of 1 second delay after 20 polling iterations). The only drawback is potentially reduced response time of your application. The good part: Heavy load (e.g. connection requests or incoming traffic) will reduce this problem. Eventually your accepting thread won't wait at all if there are several connection requests queued.

This workaround may be removed if someone is willing to sacrifice to improve the IO manager on Windows.

Dependencies

  • base
  • bytestring

Tests

Run the default test suites:

cabal test