Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 229


Ignore:
Timestamp:
Nov 20, 2007, 9:36:41 PM (17 years ago)
Author:
scheusso
Message:

added class Client (rootclass of the network module for the client) and modified makefile

Location:
code/branches/network/src/network
Files:
2 added
4 edited

Legend:

Unmodified
Added
Removed
  • code/branches/network/src/network/ClientConnection.cc

    r217 r229  
    5050  }
    5151 
    52   void ClientConnection::createConnection(){
     52  bool ClientConnection::createConnection(){
    5353    network_threads.create_thread(boost::bind(boost::mem_fn(&ClientConnection::receiverThread), this));
    54 //     boost::thread thr(boost::bind(boost::mem_fn(&ClientConnection::receiverThread), this));
    55     return;
     54    // wait 10 seconds for the connection to be established
     55    return waitEstablished(10000);
    5656  }
    5757 
     
    7777      return false;
    7878    if(enet_host_service(client, event, NETWORK_SEND_WAIT)>=0)
     79      return true;
     80    else
     81      return false;
     82  }
     83 
     84  bool ClientConnection::sendPackets(){
     85    ENetEvent event;
     86    if(server==NULL)
     87      return false;
     88    if(enet_host_service(client, &event, NETWORK_SEND_WAIT)>=0)
    7989      return true;
    8090    else
  • code/branches/network/src/network/ClientConnection.h

    r217 r229  
    4141    bool queueEmpty();
    4242    // create a new listener thread
    43     void createConnection();
     43    bool createConnection();
    4444    bool closeConnection();
    4545    // add a packet to queue for the server
    4646    bool addPacket(ENetPacket *packet);
    4747    // send out all queued packets
     48    bool sendPackets();
     49    // send out all queued packets and save result in event
    4850    bool sendPackets(ENetEvent *event);
    4951    bool waitEstablished(int milisec);
  • code/branches/network/src/network/ConnectionManager.cc

    r204 r229  
    7373 
    7474  bool ConnectionManager::addPacket(ENetPacket *packet, int ID){
    75     if(client=NULL)
     75    if(client==NULL)
    7676      return false;
    7777    ClientList *temp=client;
  • code/branches/network/src/network/Makefile

    r217 r229  
    2323PacketDecoder.o: PacketDecoder.cc
    2424        ${CC} -c PacketDecoder.cc -o PacketDecoder.o -g ${INC}
    25 
     25Client.o: Client.cc
     26        ${CC} -c Client.cc -g ${INC}
    2627
    2728clean:
Note: See TracChangeset for help on using the changeset viewer.