class EncryptedTcp::TcpListener

Overview


TCP_LISTENER is a production ready example of a crystal TCPSocket listener with a pool of 200 fibers ready to process incoming data

There are numerous caveats and tweaks you can do to optmize for your situation, where this example tries to meet a 'happy medium' between short lived TCP connections and large data bursts over a TCP socket.


Defined in:

tcp_engine/tcp_listener.cr

Constant Summary

TOTAL_FIBERS = (ENV["TOTAL_FIBERS"]? || "5000").to_i

Constructors

Instance Method Summary

Constructor Detail

def self.new(host : String, port : Int32, action : ActionHandler, config : Hash(String, String)) #

[View source]

Instance Method Detail

def build_channel #

[View source]
def get_socket_data(socket : TCPSocket, &) #

[View source]
def listen #

[View source]
def reader(socket : TCPSocket) #

[View source]
def set_trap #

Convernience method to turn on DEBUG with a USR1 signal


[View source]
def spawn_listener(socket_channel : Channel) #

[View source]
def stats_response(socket : TCPSocket) #

[View source]