Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Dec 31, 2007, 7:40:23 PM (17 years ago)
Author:
rgrieder
Message:
  • added dll support to the network library
  • improved header file dependency in network
File:
1 edited

Legend:

Unmodified
Added
Removed
  • code/branches/FICN/src/network/dummyclient3.cc

    r632 r777  
    11#include <iostream>
    22#include <string>
     3
     4#include "util/Sleep.h"
    35#include "PacketManager.h"
    46#include "Client.h"
    5 
    6 #ifdef WIN32
    7 #include <windows.h>
    8 #define usleep(x) Sleep((x)/1000)
    9 #else
    10 #include <unistd.h>
    11 #endif
    127
    138using namespace network;
     
    2621  Client client( str, PORT );
    2722  if ( client.establishConnection() )
    28           std::cout << "connection established" << std::endl;
     23    std::cout << "connection established" << std::endl;
    2924  else std::cout << "problems establishing connection" << std::endl;
    3025  char message[10000];
    3126  char signs[] = "abcdefghijklmnopqrstuvwxy";
    3227  while (true) {
    33           client.tick(0);
    34          
    35           std::cout << "your message2: ";
    36           for ( int i=0; i<9999; i++ ) {
    37             message[i] = signs[0];
    38           }
    39           message[9999] = 'z';
    40           std::string str( message );
    41           client.sendChat( str );
    42           std::cout << str << std::endl;
    43           std::cin.get(); std::cin.get();
     28    client.tick(0);
     29
     30    std::cout << "your message2: ";
     31    for ( int i=0; i<9999; i++ ) {
     32      message[i] = signs[0];
     33    }
     34    message[9999] = 'z';
     35    std::string str( message );
     36    client.sendChat( str );
     37    std::cout << str << std::endl;
     38    std::cin.get(); std::cin.get();
    4439  }
    4540
     
    4944
    5045void listener(){
    51        
     46
    5247  const int PORT = 55556;
    5348  std::cout << "Enter address of the server xxx.xxx.xxx.xxx (enter for localhost)" << std::endl;
     
    6055  Client client( str, PORT );
    6156  if ( client.establishConnection() )
    62           std::cout << "connection established" << std::endl;
     57    std::cout << "connection established" << std::endl;
    6358  else std::cout << "problems establishing connection" << std::endl;
    6459
    6560  while (true) {
    66           client.tick(0);
    67           usleep(100);
     61    client.tick(0);
     62    usleep(100);
    6863  }
    6964
Note: See TracChangeset for help on using the changeset viewer.