mud++0.35/etc/
mud++0.35/etc/guilds/
mud++0.35/help/propert/
mud++0.35/mudC/
mud++0.35/player/
mud++0.35/src/interface/
mud++0.35/src/os/cygwin32/
mud++0.35/src/os/win32/
mud++0.35/src/os/win32/bcppbuilder/
mud++0.35/src/osaddon/
mud++0.35/src/util/

**** PLEASE DISREGARD THIS FILE. IT IS OUT OF DATE, WRITTEN 1/4/95
**** I PLAN TO UPDATE IT SOON.



Object.Server  0.1 - README
Released 1/4/95
Author: Melvin Smith - Mercer University, Macon GA.
----------------------------------------------------------------------------
Problems, contributions, comments, flames:
E-mail -> mudpp-list@mailhost.net or msmith@hom.net
---------------------------------------------------------------------------- 

What is Object Server?

  Object Server is a C++ class that allows you to create your programs to run 
on the internet without the requirement of being a TCP/IP guru. Even for many
capable C programmers, writing a communication module for a concurrent server
is no small task for the first time. Early versions of the server are
admittedly barebones but it should definitely make your life easier.

What can I use it for?

  If you are trying to write a chatline, MUD, or other internet multi-user
application then this is the perfect foundation.
You can use the object and get right to coding your application. Personnally
I am developing a Multi-User-Dimension and wrote it for that only. As stands
the server defaults to TCP, Inet family. Member functions will be added to
set MOST common socket options. If you would like to use the server but it
doesn't offer an adequate interface then E-mail me about your ideas.

What about portability and stability?

  I make no claims about portability, mainly because I dont have access
to many C++ compilers besides my own. I would expect the code to compile
on most platforms that have "proposed ANSI" C++ support. I use
gcc/g++ 2.5.8 and up. If you find that you must hack the code for ANY
reason to get it to compile or run, PLEASE E-mail me and Ill get it fixed. 

Copyright?

Read the file 'LICENSE'


C++ ? whats that?

 Basically all you need to know if you JUST want to use the server object and
code your stuff in C is how to define and call the object and members.
You dont worry about manipulating any internal data, just use the object as is
and call the interfaces. Example, the server is booted and I want to find out
the hostname of a descriptor...
 
Server server;

then I do something like..

server.boot( 4000 );  // opens and accepts connections on TCP port 4000

----------------------------------------------------------------------------
Step-by-Step (demo.cc)

 I have included a quick little hack of a C++ main() that creates a server
object and uses it as an "echo server". This just accepts connections and
echos back to the user the input. Also supports multiple connections so when
you type something, all other connections get it too. (Chat server in a box!)

First read the steps below which describe the steps, then read and
compile demo.cc which is included in this directory and run it.

	Copy to src and cd there:
	> cp demo.cc ../src
	> cd ../src

	Compile:
	> c++ -o demo demo.cc server.cc socket.cc io.cc ltoa.cc

	Run:
	> demo &

	Test:
	> telnet localhost 4000



1) Creating the server.
   You must #include "server.h" to make use of it.
   Also compile server.cc and link it against your main module or
   create a Makefile.
   
   In your program you must create an instance (actual object) of the Server
   class. There are several ways to do it. Make sure it is either global,
   in top level main() or static (you dont want it to be destroyed until your
   program exits).

   The easiest way is making an instance in main like this...

   Server server(4000);

   To do dynamic allocation use the C++ method, "new"...

   Server *server = new Server(4000);

   Notice the parentheses. This is a C++ constructor. This is just a function
   that is executed each time an object is created. The function is local to 
   that object. This is passing the PORT # that you want your server to run
   on. It is possible to have a port allocated to you by passing a PORT of
   less than 1024 (this is reserved range). Not much support though if you
   request an auto port. Generally user defined apps use a set PORT to keep
   things consistent for the clients. The default port is 4000 so you can also
   do this:

   Server server;  (This will boot on PORT 4000) 

2) Wasn't that easy. Now all you do is call the member function Boot()...

   server.boot( 4000 );

   You should get some mesages, you will know if the server booted or not.
   You may notice that in my code I also do :

   server.useNameServer();

   If you have a reliable name server you may want to do this in your app also
   but there can be problems if your nameserver is slow. This can cause the
   program to hang sometimes. Just try it, if you have problems then delete
   the call, you will still get numerical IP addresses (111.222.333.444)
   when calling server.GetHostName( desc );

3) If all is successful you can now accept connections. Basically I start
   an infinite loop of polling the server. 

   server.poll();

   You need to call this each time through to update the server on who is
   ready to read, write, or if there is new connection.

4) To check for new connections do something like...
 
   if( server.newConnection() )

5) then if so, call...

   Socket * newSock = server.accept();

	This returns a pointer to a Socket object which you can use
	to communicate with the client or query info about his connection.
	When you are done with that connection you need to:

	1)	Close the socket
		> newSock->close();

	2)	Remove the socket from the Server object.
		> server.remove( newSock );

	3)	Destroy the socket object
		> delete newSock;

7) Dont worry about cleaning up the server, providing you exit normal either
   with en actual exit() or not, the object destroys all its stuff and
   closes the socket.

8) I apologize for the brevity of this README and the incompletenss of the
   server but I hardly have time to do anything as it is.


Good Luck!!
Melvin Smith
msmith@hom.net