@hackage libtelnet0.1.0.1
Bindings to libtelnet
Categories
License
GPL-3.0-or-later
Maintainer
jack@jackkelly.name
Links
Versions
Installation
Tested Compilers
Dependencies (2)
- base >=4.9 && <4.17
- bytestring >=0.10.6.0 && <0.12 Show all…
Dependents (1)
@hackage/reflex-libtelnet
Package Flags
example
(off by default)
Build the example program
Bindings to libtelnet
This is a wrapper around libtelnet, a C library for handling Telnet streams, including option negotiation, &c. As a cleartext protocol, Telnet is thorougly unsuitable for use on the open internet, but you might have a niche where it makes sense:
- MU* games still use it, and so the clients people want to use only speak Telnet,
- You might be speaking Telnet inside a stunnel, or
- You might have some ancient hardware that can't be updated, and doesn't have ssh, but you want to talk to it using Haskell.
This library hews closely to the interface provided by the C libtelnet, so reading the excellent C documentation will help you. The short version goes something like this:
-
Define an event handler of type
Network.Telnet.LibTelnet.EventHandler
. This function receives callbacks that tell you what received data should be propagated to the application, and what bytes need to be sent out over the socket. -
Pass your event handler (and some other flags) to
Network.Telnet.LibTelnet.telnetInit
, which will give you access to aTelnet
, a garbage-collected state tracker. -
Tell the state tracker that data has arrived on the socket, or that you want to send data to the socket, by passing it to the library's other functions.
Other Resources
-
A simple server example exists in
example/Main.hs
. -
Questions should go to the libtelnet-haskell-discuss mailing list.
-
Bug reports should go to the bug tracker.