Popularity
3.6
Declining
Activity
0.0
Stable
10
4
0
Programming language: Crystal
License: MIT License
Tags:
Network Protocols
Latest version: v1.0.1
telnet.cr alternatives and similar shards
Based on the "Network Protocols" category.
Alternatively, view telnet.cr alternatives based on common mentions on social networks and blogs.
-
simple_rpc
RPC Server and Client for Crystal. Implements msgpack-rpc protocol. -
crystal-mqtt
Crystal lang implementation of the MQTT protocol, a lightweight protocol for publish/subscribe messaging -
crystal-json-socket
JSON-socket client & server implementation. Inspired by and compatible with sebastianseilund/node-json-socket -
gopher.cr
A fast, extensible, Gopher-protocol server written in Crystal
Free Global Payroll designed for tech teams
Building a great tech team takes more than a paycheck. Zero payroll costs, get AI-driven insights to retain best talent, and delight them with amazing local benefits. 100% free and compliant.
Promo
try.revelo.com
Do you think we are missing an alternative of telnet.cr or a related project?
README
Telnet
Telnet protocol support for Crystal Lang. Does not implement transport, just the raw protocol.
Usage
There are three processes that need to implemented to talk to a Telnet device or service.
- Incoming data needs to be buffered, this handles protocol specific operations and unescapes incomming messages.
- A callback for sending protocol level responses to the far-end
- Preparing a message for transmission
require "telnet"
telnet = Telnet.new do |cmd_response|
# This is a response to a request from the far end
# it should be transferred to the remote
end
# Buffer incoming data for unescaping and command processing
clear_text = telnet.buffer("a string or slice / Bytes")
# Prepare data for sending to the remote (i.e. the application level protocol)
# The prepare function adds the appropriate line endings, as per the telnet session negotiations
encoded_response = telnet.prepare("hello")
An example with the IO implemented properly
require "telnet"
socket = TCPSocket.new("192.168.0.60", 23)
telnet = Telnet.new do |cmd_response|
# This is a response to a request from the far end
socket.write cmd_response
end
# Buffer incoming data for unescaping and command processing
encoded = socket.gets
clear_text = telnet.buffer(encoded)
# Prepare data for sending to the remote
encoded_response = telnet.prepare("hello")
socket.write encoded_response
If you are sending binary data to the remote you'll want to escape it
data = Bytes[3, 255, 4, 40, 255, 30, 20]
encoded_response = telnet.prepare(data, escape: true)
socket.write encoded_response
encoded_response # => Bytes[3, 255, 255, 4, 40, 255, 255, 30, 20, 13, 10]