Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changes between Version 2 and Version 3 of code/doc/network/Host


Ignore:
Timestamp:
Sep 17, 2008, 4:19:22 PM (16 years ago)
Author:
scheusso
Comment:

Legend:

Unmodified
Added
Removed
Modified
  • code/doc/network/Host

    v2 v3  
    33The basic task of these classes is the interface between Orxonox and the network engine. This includes creating and opening a server, connecting to a server as client and provide common functions (for Server and Client) like sendChat.
    44
    5 The Host class is the parent class of Server and Client. It ensures that only one instance of either Server or Client is running (so called Singleton) and provides static functions that both (Server and Client) have to implement.
     5Host is the parent class of Server and Client. It ensures that only one instance of either Server or Client is running (so called Singleton) and provides static functions that both (Server and Client) have to implement.
    66
    77== Host class and common functions ==
     
    1010|| running() || Tells you whether an instance of Server or Client exists (no Information, wheter connected or not) ||
    1111|| isServer() || Tells you whether the instance is a Server or not ||
    12 || sendChat(unsigned char *message) || Sends a message to the server or the clients ||
     12|| sendChat(message) || Sends a message to the server or the clients ||
    1313
    1414== Server class ==
    15 
    16 
     15Obviously this class implements a server. See below for usage.[[BR]]
     16Special functions of Server (not included in Host):
     17|| '''Function Name''' || '''Description''' ||
     18|| Server() || Constructor: sets port to 55556 and binds to all addresses ||
     19|| Server(int portnr) || Constructor: sets port to portnr ||
     20|| Server(int portnr, string bindaddress) || Constructor: sets port to portnr and listens to bindaddress ||
     21|| open() || opens the listener and accepts new connections ||
     22|| close() || closes the listener ||
    1723== Client class ==
     24Special functions of Client (not included in Host):
     25|| '''Function Name''' || '''Description''' ||
     26|| Client() || Constructor: sets destination address and port to localhost|55556 ||
     27|| Client(string address, int port) || Constructor with user defined destination address and port ||
     28|| establishConnection() || tries to connect to the server ||
     29|| closeConnection() || closes the connection ||
     30== ClientInformation ==
     31This class implements a list with all neccessary information about a client (e.g. network address, port, PlayerID, shipID, gamestateID, ...). It is for internal use only.
    1832
    1933== Usage Examples ==
     34Server usage:
     35{{{
     36network::Server server(); // this creates the server and sets port and bindaddress to the default values
     37server.open();
     38}}}
     39Client usage:
     40{{{
     41network::Client client(address, port); // this creates the client and sets port and dest.address to appropriate values
     42if(client.establishConnection())
     43  ... //success
     44else
     45  ... //failure
     46}}}