Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 5732 in orxonox.OLD for branches/network/src


Ignore:
Timestamp:
Nov 23, 2005, 2:59:11 PM (19 years ago)
Author:
rennerc
Message:

network_socket: added constructor which connects directly

Location:
branches/network/src
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • branches/network/src/lib/network/network_socket.cc

    r5729 r5732  
    5858  PRINTF(0)("NetworkSocket created\n");
    5959
     60}
     61
     62/**
     63 * Constructor to connect directly
     64 */
     65NetworkSocket::NetworkSocket(char * ipAddress, unsigned int port)
     66{
     67  NetworkSocket();
     68  IPaddress ip;
     69  SDLNet_ResolveHost(&ip, ipAddress, port);
     70  connectToServer(ip, port);
    6071}
    6172
  • branches/network/src/lib/network/network_socket.h

    r5729 r5732  
    2424#ifdef HAVE_SDL_H
    2525#include <SDL_Thread.h>
    26 #else 
     26#else
    2727#include <SDL/SDL_thread.h>
    2828#endif
     
    7373
    7474  NetworkSocket();
     75  NetworkSocket(char * ipAddress, unsigned int port);
    7576  ~NetworkSocket();
    7677
  • branches/network/src/subprojects/network/network_unit_test.cc

    r5650 r5732  
    3030int testSocket(int argc, char** argv)
    3131{
    32   NetworkSocket client;
    3332  NetworkSocket server;
    34   IPaddress ip;
    35   SDLNet_ResolveHost(&ip, "127.0.0.1", 9999);
    3633  server.listen(9999);
    3734  SDL_Delay(20);
    38   client.connectToServer(ip, 9999);
     35
     36  NetworkSocket client("127.0.0.1", 9999);
     37
    3938  char buf[1024];
    4039
     
    121120  printf("TestFramework\n");
    122121  printf("=================\n");
    123  
     122
    124123  IPaddress ip;
    125124  //SDLNet_ResolveHost(&ip, "127.0.0.1", 9999);
     
    127126  Synchronizeable* clientSync = new SimpleSync();
    128127  Synchronizeable* serverSync = new SimpleSync();
    129  
    130  
    131  
     128
     129
     130
    132131  /* create the network manager */
    133132  NetworkManager* nm = new NetworkManager();
     
    138137  /* create a server stream */
    139138  nm->createServer(*serverSync, 9999);
    140  
     139
    141140  /* esatblish a connection */
    142141  nm->establishConnection(ip, *clientSync);
     
    146145    nm->synchronize();
    147146  }
    148  
     147
    149148  /* delete the network manager again */
    150149  delete nm;
    151  
     150
    152151  return 0;
    153152}
     
    172171
    173172  startHelp(argc, argv);
    174  
     173
    175174  return 0;
    176175}
Note: See TracChangeset for help on using the changeset viewer.