lichat tcp server
1.0.0A simple TCP server implementation for lichat.
Table of Contents
About Lichat-TCP-Server
This is a simple, threaded, TCP-based server for the Lichat protocol.
How To
Create a new server instance and pass it whatever settings you would like.
(defvar *server* (make-instance 'lichat-tcp-server:server)) Notable initargs of potential interest are:
:nameThe name the server goes by on its own network. Defaults to(machine-instance).:hostnameThe hostname to which the TCP listener should bind. The default is0.0.0.0.:portThe port the TCP listener should listen on. The default is1111.:ping-intervalThe interval in which pings should be sent out to clients. The default is60.:saltThe salt with which passwords are hashed. The default is an empty string.:idle-timeoutThe number of seconds without a response from a client after which it is considered to have timed out. The default is120.:flood-frameThe size of a flood prevention frame. The default is30.:flood-limitThe number of allowed updates within a frame before flood limitation takes effect. The default is40.:connection-limitThe number of connections in total that the server supports before dropping incoming ones. The default is100.
Once a server exists, it can be started to listen to incoming connections:
(lichat-tcp-server:open-connection *server*) The server logs information via Verbose. If you set the REPL level to :trace you should see a bunch of status messages being printed every now and again.
Once you're done with the server, you can shut it down again.
(lichat-tcp-server:close-connection *server*) Also See
- lichat-protocol The Lichat protocol specification.
- lichat-serverlib An agnostic implementation of the server-side protocol.
- lichat-tcp-client A basic, threaded, TCP-based implementation of a Lichat client.
- LionChat A Qt GUI client for a TCP server.
System Information
Definition Index
-
LICHAT-TCP-SERVER
- ORG.SHIRAKUMO.LICHAT.TCP-SERVER
No documentation provided.-
EXTERNAL SPECIAL-VARIABLE *DEFAULT-PORT*
The standard port on which the server will run. Should be 1111.
-
EXTERNAL CLASS CHANNEL
Channel class. Access to the channel is properly handled for mutual exclusion from threads by its LOCK. Particularly, the following methods are mutually excluded via this lock: LICHAT-SERVERLIB:JOIN LICHAT-SERVERLIB:LEAVE See LICHAT-SERVERLIB:CHANNEL See LOCK
-
EXTERNAL CLASS CONNECTION
Connection class. Each connection to a client will have an instance of this class. Access to the connection is properly handled for mutual exclusion from threads by its LOCK. Particularly, the following methods are mutually excluded via this lock: LICHAT-SERVERLIB:SEND See LICHAT-SERVERLIB:FLOOD-PROTECTED-CONNECTION See SOCKET See THREAD See LOCK
-
EXTERNAL CLASS SERVER
Server class. You should instantiate this. Access to the server is properly handled for mutual exclusion from threads by its LOCK. Particularly, the following updates and processing methods for updates are mutually excluded via this lock: LICHAT-SERVERLIB:TEARDOWN-CONNECTION LICHAT-PROTOCOL:CONNECT LICHAT-PROTOCOL:REGISTER LICHAT-PROTOCOL:CREATE See LICHAT-SERVERLIB:FLOOD-PROTECTED-SERVER See HOSTNAME See PORT See THREAD See PING-INTERVAL See LOCK See CONNECTIONS
-
EXTERNAL CLASS USER
User class. Access to the user is properly handled for mutual exclusion from threads by its LOCK. Particularly, the following methods are mutually excluded via this lock: LICHAT-SERVERLIB:JOIN LICHAT-SERVERLIB:LEAVE See LICHAT-SERVERLIB:USER See LOCK
-
EXTERNAL FUNCTION ENSURE-HOSTNAME
- HOST-ISH
Ensures that the host-ish is turned into a hostname string.
-
EXTERNAL GENERIC-FUNCTION CLOSE-CONNECTION
- SERVER
Stop accepting incoming connections and close all existing ones. Can be used with either a SERVER or a CONNECTION. See CONNECTIONS See THREAD See SERVER See CONNECTION
-
EXTERNAL GENERIC-FUNCTION CONNECTION-LIMIT
- OBJECT
No documentation provided. -
EXTERNAL GENERIC-FUNCTION (SETF CONNECTION-LIMIT)
- NEW-VALUE
- OBJECT
No documentation provided. -
EXTERNAL GENERIC-FUNCTION CONNECTIONS
- OBJECT
Accessor to the list of connections on the server. See SERVER See CONNECTION
-
EXTERNAL GENERIC-FUNCTION (SETF CONNECTIONS)
- NEW-VALUE
- OBJECT
No documentation provided. -
EXTERNAL GENERIC-FUNCTION ESTABLISH-CONNECTION
- SOCKET
- SERVER
Responsible for establishing a new connection to a client. This will construct and push a new CONNECTION object onto the server using the given socket. It will also launch the CONNECTION's background handling thread.
-
EXTERNAL GENERIC-FUNCTION HANDLE-CONNECTION
- SERVER
Handle the socket with the given object. The object should be either a SERVER or a CONNECTION. In the case of the server, it will listen for new clients and if one is found, call ESTABLISH-CONNECTION. In the case of the client, it will first manage connection establishment as per the Lichat protocol, then repeatedly wait for a new update with a timeout. If the timeout is reached, a PING update is sent to the connection. If an update is received, it is PROCESSED. If the socket ever experiences a connection problem (timeout, shutdown, reset, etc) then the connection is immediately closed. Provides a CLOSE-CONNECTION restart as mandated by the serverlib. See SERVER See CONNECTION See ESTABLISH-CONNECTION See LICHAT-SERVERLIB:PROCESS
-
EXTERNAL GENERIC-FUNCTION HOSTNAME
- OBJECT
Accessor to the hostname of the connection. See CONNECTION
-
EXTERNAL GENERIC-FUNCTION (SETF HOSTNAME)
- NEW-VALUE
- OBJECT
No documentation provided. -
EXTERNAL GENERIC-FUNCTION LOCK
- OBJECT
Accessor to the lock of the object that is used to mutually exclude access. See SERVER See CONNECTION See USER See CHANNEL
-
EXTERNAL GENERIC-FUNCTION (SETF LOCK)
- NEW-VALUE
- OBJECT
No documentation provided. -
EXTERNAL GENERIC-FUNCTION OPEN-CONNECTION
- SERVER
Start accepting incoming connections on the server. This will launch a background thread which will call HANDLE-CONNECTION on the socket and server. See HANDLE-CONNECTION See THREAD See SERVER
-
EXTERNAL GENERIC-FUNCTION PING-INTERVAL
- OBJECT
Accessor to the amount of seconds to wait for an update before sending a PING. See SERVER
-
EXTERNAL GENERIC-FUNCTION (SETF PING-INTERVAL)
- NEW-VALUE
- OBJECT
No documentation provided. -
EXTERNAL GENERIC-FUNCTION PORT
- OBJECT
Accessor to the port of the connection. See CONNECTION
-
EXTERNAL GENERIC-FUNCTION (SETF PORT)
- NEW-VALUE
- OBJECT
No documentation provided. -
EXTERNAL GENERIC-FUNCTION SOCKET
- OBJECT
Accessor to the TCP socket of the connection. See USOCKET:SOCKET See CONNECTION
-
EXTERNAL GENERIC-FUNCTION (SETF SOCKET)
- NEW-VALUE
- OBJECT
No documentation provided. -
EXTERNAL GENERIC-FUNCTION THREAD
- OBJECT
Accessor to the background processing thread of the object. See SERVER See CONNECTION
-
EXTERNAL GENERIC-FUNCTION (SETF THREAD)
- NEW-VALUE
- OBJECT
No documentation provided.