class Mud::Net::Server

Overview

A TCP server to host the game, which handles client connections.

Defined in:

net.cr

Constructors

Class Method Summary

Instance Method Summary

Constructor Detail

def self.new(host, port) #

Creates a TCP socket and spawns a fiber to wait for connections.


[View source]

Class Method Detail

def self.open(host, port, &) #

Starts a server instance and yields it to the block.


[View source]

Instance Method Detail

def accept #

Spawns a new handler fiber on each client connection.


[View source]
def broadcast(msg, exclude = -1) #

Broadcasts a message to all connected clients. Does not send to exclude.


[View source]
def client_reader(id, socket, channel, done) #

Reads messages from the client.


[View source]
def client_writer(id, socket, channel, done) #

Writes messages to the client.


[View source]
def close #

Closes the server and all channels.


[View source]
def handle_client(socket, id, channel) #

Sends and receives messages from a client connection.


[View source]
def hide(id) #

Tells the client to hide typed text.


[View source]
def run(&) #

Runs main event loop which processes messages to and from clients and then yields for game operations to take place.


[View source]
def send(id, msg) #

Sends a message to a specific connected client.


[View source]
def unhide(id) #

Tells the client to unhide typed text.


[View source]