summaryrefslogtreecommitdiff
path: root/docs/common/lib_server/ServerStream.txt
diff options
context:
space:
mode:
authorReinhard Tartler <siretart@tauware.de>2009-03-31 15:58:19 +0200
committerReinhard Tartler <siretart@tauware.de>2009-03-31 15:58:19 +0200
commit25db897553a0db0f912602b375029e724f51556e (patch)
tree613c8c23e22481e31a4d2f474e022ad87728da24 /docs/common/lib_server/ServerStream.txt
parent2787035d98661881477d696403ca2a78b49322d5 (diff)
Import upstream version 0.11~rc2+r2072
Diffstat (limited to 'docs/common/lib_server/ServerStream.txt')
-rw-r--r--docs/common/lib_server/ServerStream.txt29
1 files changed, 29 insertions, 0 deletions
diff --git a/docs/common/lib_server/ServerStream.txt b/docs/common/lib_server/ServerStream.txt
new file mode 100644
index 00000000..6c5932a0
--- /dev/null
+++ b/docs/common/lib_server/ServerStream.txt
@@ -0,0 +1,29 @@
+CLASS ServerStream
+
+ServerStream implementes a Daemon which accepts stream connections over sockets, and forks into a child process to handle them.
+
+To implement a daemon, derive from
+
+ ServerStream<SocketStream, SERVER_LISTEN_PORT>
+
+The type SocketStream specifies that incoming connections should be treated as normal sockets, and SERVER_LISTEN_PORT is the port to listen to (if it's a inet socket, and if not overridden in the config file). The actual addresses (or names) to bind to are specified in the configuration file by the user.
+
+Make sure SERVERSTREAM_VERIFY_SERVER_KEYS(0) is included in the configuration verification structure in the "Server" sub configuration. 0 could be replaced with a default address, for example "unix:/var/run/server.sock" to specific a default UNIX socket in the filesystem.
+
+See test/basicserver for a simple example.
+
+The ListenAddresses key in the Server subconfiguration is a comma separated list of addresses, specified as family:name. Internet sockets are family 'inet', for example 'inet:localhost' (or 'inet:localhost:1080' to specify a port number as well), and unix domain sockets are 'unix', example above.
+
+
+Override Connection to handle the connection.
+
+Remember to override Daemon functions like the server name, and start it up, just like a generic Daemon.
+
+
+FUNCTION ServerStream::Connection
+
+This function takes a connected stream as it's argument. It should then proceed to do whatever it needs to do to talk to the client.
+
+Using IOStreamGetLine or a Protocol class to communicate may be quick ways of implementing this functionality.
+
+