Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 5650 in orxonox.OLD for branches


Ignore:
Timestamp:
Nov 20, 2005, 3:39:38 AM (19 years ago)
Author:
patrick
Message:

network: finished the simple_sync program

Location:
branches/network/src
Files:
30 edited

Legend:

Unmodified
Added
Removed
  • branches/network/src/Makefile.in

    r5580 r5650  
    1 # Makefile.in generated by automake 1.9.6 from Makefile.am.
     1# Makefile.in generated by automake 1.9.5 from Makefile.am.
    22# @configure_input@
    33
     
    1515@SET_MAKE@
    1616
     17
     18SOURCES = $(orxonox_SOURCES)
    1719
    1820srcdir = @srcdir@
  • branches/network/src/lib/Makefile.in

    r5530 r5650  
    1 # Makefile.in generated by automake 1.9.6 from Makefile.am.
     1# Makefile.in generated by automake 1.9.5 from Makefile.am.
    22# @configure_input@
    33
     
    1515@SET_MAKE@
    1616
     17
     18SOURCES = $(libORXlibs_a_SOURCES)
    1719
    1820srcdir = @srcdir@
  • branches/network/src/lib/collision_detection/Makefile.in

    r5530 r5650  
    1 # Makefile.in generated by automake 1.9.6 from Makefile.am.
     1# Makefile.in generated by automake 1.9.5 from Makefile.am.
    22# @configure_input@
    33
     
    1515@SET_MAKE@
    1616
     17
     18SOURCES = $(libORXcd_a_SOURCES)
    1719
    1820srcdir = @srcdir@
  • branches/network/src/lib/event/Makefile.in

    r5530 r5650  
    1 # Makefile.in generated by automake 1.9.6 from Makefile.am.
     1# Makefile.in generated by automake 1.9.5 from Makefile.am.
    22# @configure_input@
    33
     
    1515@SET_MAKE@
    1616
     17
     18SOURCES = $(libORXevent_a_SOURCES)
    1719
    1820srcdir = @srcdir@
  • branches/network/src/lib/graphics/Makefile.in

    r5530 r5650  
    1 # Makefile.in generated by automake 1.9.6 from Makefile.am.
     1# Makefile.in generated by automake 1.9.5 from Makefile.am.
    22# @configure_input@
    33
     
    1515@SET_MAKE@
    1616
     17
     18SOURCES = $(libORXgraphics_a_SOURCES)
    1719
    1820srcdir = @srcdir@
  • branches/network/src/lib/graphics/importer/Makefile.in

    r5530 r5650  
    1 # Makefile.in generated by automake 1.9.6 from Makefile.am.
     1# Makefile.in generated by automake 1.9.5 from Makefile.am.
    22# @configure_input@
    33
     
    1515@SET_MAKE@
    1616
     17
     18SOURCES = $(libORXimporter_a_SOURCES)
    1719
    1820srcdir = @srcdir@
  • branches/network/src/lib/graphics/spatial_separation/Makefile.in

    r5530 r5650  
    1 # Makefile.in generated by automake 1.9.6 from Makefile.am.
     1# Makefile.in generated by automake 1.9.5 from Makefile.am.
    22# @configure_input@
    33
     
    1515@SET_MAKE@
    1616
     17
     18SOURCES = $(libORXquadtree_a_SOURCES)
    1719
    1820srcdir = @srcdir@
  • branches/network/src/lib/gui/Makefile.in

    r5530 r5650  
    1 # Makefile.in generated by automake 1.9.6 from Makefile.am.
     1# Makefile.in generated by automake 1.9.5 from Makefile.am.
    22# @configure_input@
    33
  • branches/network/src/lib/gui/gl_gui/Makefile.in

    r5530 r5650  
    1 # Makefile.in generated by automake 1.9.6 from Makefile.am.
     1# Makefile.in generated by automake 1.9.5 from Makefile.am.
    22# @configure_input@
    33
     
    1515@SET_MAKE@
    1616
     17
     18SOURCES = $(libORXglgui_a_SOURCES)
    1719
    1820srcdir = @srcdir@
  • branches/network/src/lib/gui/gtk_gui/Makefile.in

    r5530 r5650  
    1 # Makefile.in generated by automake 1.9.6 from Makefile.am.
     1# Makefile.in generated by automake 1.9.5 from Makefile.am.
    22# @configure_input@
    33
     
    1515@SET_MAKE@
    1616
     17
     18SOURCES = $(libORXgui_a_SOURCES)
    1719
    1820srcdir = @srcdir@
  • branches/network/src/lib/network/Makefile.in

    r5614 r5650  
    1 # Makefile.in generated by automake 1.9.6 from Makefile.am.
     1# Makefile.in generated by automake 1.9.5 from Makefile.am.
    22# @configure_input@
    33
     
    1515@SET_MAKE@
    1616
     17
     18SOURCES = $(libORXnet_a_SOURCES)
    1719
    1820srcdir = @srcdir@
  • branches/network/src/lib/network/network_stream.cc

    r5649 r5650  
    8585  byte* test = (byte *)data[0]; // obsolete, for debugging only
    8686  int ret = 0;
    87   this->synchronizeable->writeByteStream(NULL);
    88   ret = this->networkSocket->writeBytes(NULL,1);
    89   test = this->synchronizeable->readByteStream();
    90   ret = this->networkSocket->readBytes(test,1);
     87 
     88  byte downData[10];
     89  byte upData[10];
     90 
     91  /* DOWNSTREAM */
     92  /* first of all read the synchronizeable's data: */
     93  ret = this->synchronizeable->readBytes(downData);
     94  /* pass the data to the network socket */
     95  ret = this->networkSocket->writeBytes(downData, ret);
     96  /* check if there was an error */
     97  if( ret == -1) { PRINTF(0)("Error in writing data to the NetworkSocket\n");}
     98 
     99 
     100  /* UPSTREAM */
     101  /* first read 10bytes of data (debug) */
     102  ret = this->networkSocket->readBytes(upData, 0);
     103  /* error checking: data read? */
     104  if( ret != 10) { PRINTF(0)("Error while reading data from the NetworkSocket\n");}
     105  /* now pass the data to the sync object */
     106  this->synchronizeable->writeBytes(upData, 0);
     107 
     108 
     109
    91110}
    92111
  • branches/network/src/lib/network/synchronizeable.cc

    r5564 r5650  
    4141                          \brief write data to NetworkStream
    4242 */
    43  void Synchronizeable::writeByteStream(byte* data)
     43 void Synchronizeable::writeBytes(byte* data, int length)
    4444{
    4545
     
    5252                                 \brief read data from NetworkStream
    5353 */
    54  byte* Synchronizeable::readByteStream()
     54 int Synchronizeable::readBytes(byte* data)
    5555{
    5656
  • branches/network/src/lib/network/synchronizeable.h

    r5581 r5650  
    1717                   ~Synchronizeable();
    1818
    19  virtual void      writeByteStream(byte* data);
    20  virtual byte*     readByteStream();
     19 virtual void      writeBytes(byte* data, int length);
     20 virtual int       readBytes(byte* data);
    2121 virtual void      writeDebug();
    2222 virtual void      readDebug();
  • branches/network/src/lib/particles/Makefile.in

    r5530 r5650  
    1 # Makefile.in generated by automake 1.9.6 from Makefile.am.
     1# Makefile.in generated by automake 1.9.5 from Makefile.am.
    22# @configure_input@
    33
     
    1515@SET_MAKE@
    1616
     17
     18SOURCES = $(libORXparticles_a_SOURCES)
    1719
    1820srcdir = @srcdir@
  • branches/network/src/lib/physics/Makefile.in

    r5530 r5650  
    1 # Makefile.in generated by automake 1.9.6 from Makefile.am.
     1# Makefile.in generated by automake 1.9.5 from Makefile.am.
    22# @configure_input@
    33
     
    1515@SET_MAKE@
    1616
     17
     18SOURCES = $(libORXphysics_a_SOURCES)
    1719
    1820srcdir = @srcdir@
  • branches/network/src/lib/shell/Makefile.in

    r5530 r5650  
    1 # Makefile.in generated by automake 1.9.6 from Makefile.am.
     1# Makefile.in generated by automake 1.9.5 from Makefile.am.
    22# @configure_input@
    33
     
    1515@SET_MAKE@
    1616
     17
     18SOURCES = $(libORXshell_a_SOURCES)
    1719
    1820srcdir = @srcdir@
  • branches/network/src/lib/sound/Makefile.in

    r5530 r5650  
    1 # Makefile.in generated by automake 1.9.6 from Makefile.am.
     1# Makefile.in generated by automake 1.9.5 from Makefile.am.
    22# @configure_input@
    33
     
    1515@SET_MAKE@
    1616
     17
     18SOURCES = $(libORXsound_a_SOURCES)
    1719
    1820srcdir = @srcdir@
  • branches/network/src/lib/tinyxml/Makefile.in

    r5530 r5650  
    1 # Makefile.in generated by automake 1.9.6 from Makefile.am.
     1# Makefile.in generated by automake 1.9.5 from Makefile.am.
    22# @configure_input@
    33
     
    1515@SET_MAKE@
    1616
     17
     18SOURCES = $(libtinyxml_a_SOURCES)
    1719
    1820srcdir = @srcdir@
  • branches/network/src/subprojects/Makefile.in

    r5580 r5650  
    1 # Makefile.in generated by automake 1.9.6 from Makefile.am.
     1# Makefile.in generated by automake 1.9.5 from Makefile.am.
    22# @configure_input@
    33
  • branches/network/src/subprojects/collision_detection/Makefile.in

    r5580 r5650  
    1 # Makefile.in generated by automake 1.9.6 from Makefile.am.
     1# Makefile.in generated by automake 1.9.5 from Makefile.am.
    22# @configure_input@
    33
     
    1515@SET_MAKE@
    1616
     17
     18SOURCES = $(collision_SOURCES)
    1719
    1820srcdir = @srcdir@
  • branches/network/src/subprojects/importer/Makefile.in

    r5580 r5650  
    1 # Makefile.in generated by automake 1.9.6 from Makefile.am.
     1# Makefile.in generated by automake 1.9.5 from Makefile.am.
    22# @configure_input@
    33
     
    1414
    1515@SET_MAKE@
     16
     17SOURCES = $(importer_SOURCES)
    1618
    1719srcdir = @srcdir@
  • branches/network/src/subprojects/network/Makefile.am

    r5649 r5650  
    1414
    1515network_SOURCES=  network_unit_test.cc \
     16                  simple_sync.cc \
    1617                  \
    1718                  \
     
    2425
    2526
    26 noinst_HEADERS  =  network_unit_test.h
     27noinst_HEADERS  =  network_unit_test.h \
     28                   simple_sync.h
    2729
  • branches/network/src/subprojects/network/Makefile.in

    r5619 r5650  
    1 # Makefile.in generated by automake 1.9.6 from Makefile.am.
     1# Makefile.in generated by automake 1.9.5 from Makefile.am.
    22# @configure_input@
    33
     
    1515@SET_MAKE@
    1616
     17
     18SOURCES = $(network_SOURCES)
    1719
    1820srcdir = @srcdir@
     
    5456PROGRAMS = $(bin_PROGRAMS)
    5557am_network_OBJECTS = network-network_unit_test.$(OBJEXT) \
    56         network-base_object.$(OBJEXT) network-class_list.$(OBJEXT) \
    57         network-load_param.$(OBJEXT) network-substring.$(OBJEXT) \
    58         network-helper_functions.$(OBJEXT)
     58        network-simple_sync.$(OBJEXT) network-base_object.$(OBJEXT) \
     59        network-class_list.$(OBJEXT) network-load_param.$(OBJEXT) \
     60        network-substring.$(OBJEXT) network-helper_functions.$(OBJEXT)
    5961network_OBJECTS = $(am_network_OBJECTS)
    6062network_DEPENDENCIES = $(MAINSRCDIR)/lib/network/libORXnet.a \
     
    192194
    193195network_SOURCES = network_unit_test.cc \
     196                  simple_sync.cc \
    194197                  \
    195198                  \
     
    198201                  $(MAINSRCDIR)/util/loading/load_param.cc \
    199202                  $(MAINSRCDIR)/lib/util/substring.cc \
    200                   $(MAINSRCDIR)/lib/util/helper_functions.cc
    201 
    202 noinst_HEADERS = network_unit_test.h
     203                  $(MAINSRCDIR)/lib/util/helper_functions.cc
     204
     205noinst_HEADERS = network_unit_test.h \
     206                   simple_sync.h
     207
    203208all: all-am
    204209
     
    272277@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/network-load_param.Po@am__quote@
    273278@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/network-network_unit_test.Po@am__quote@
     279@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/network-simple_sync.Po@am__quote@
    274280@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/network-substring.Po@am__quote@
    275281
     
    301307@AMDEP_TRUE@@am__fastdepCXX_FALSE@      DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
    302308@am__fastdepCXX_FALSE@  $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(network_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o network-network_unit_test.obj `if test -f 'network_unit_test.cc'; then $(CYGPATH_W) 'network_unit_test.cc'; else $(CYGPATH_W) '$(srcdir)/network_unit_test.cc'; fi`
     309
     310network-simple_sync.o: simple_sync.cc
     311@am__fastdepCXX_TRUE@   if $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(network_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT network-simple_sync.o -MD -MP -MF "$(DEPDIR)/network-simple_sync.Tpo" -c -o network-simple_sync.o `test -f 'simple_sync.cc' || echo '$(srcdir)/'`simple_sync.cc; \
     312@am__fastdepCXX_TRUE@   then mv -f "$(DEPDIR)/network-simple_sync.Tpo" "$(DEPDIR)/network-simple_sync.Po"; else rm -f "$(DEPDIR)/network-simple_sync.Tpo"; exit 1; fi
     313@AMDEP_TRUE@@am__fastdepCXX_FALSE@      source='simple_sync.cc' object='network-simple_sync.o' libtool=no @AMDEPBACKSLASH@
     314@AMDEP_TRUE@@am__fastdepCXX_FALSE@      DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
     315@am__fastdepCXX_FALSE@  $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(network_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o network-simple_sync.o `test -f 'simple_sync.cc' || echo '$(srcdir)/'`simple_sync.cc
     316
     317network-simple_sync.obj: simple_sync.cc
     318@am__fastdepCXX_TRUE@   if $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(network_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT network-simple_sync.obj -MD -MP -MF "$(DEPDIR)/network-simple_sync.Tpo" -c -o network-simple_sync.obj `if test -f 'simple_sync.cc'; then $(CYGPATH_W) 'simple_sync.cc'; else $(CYGPATH_W) '$(srcdir)/simple_sync.cc'; fi`; \
     319@am__fastdepCXX_TRUE@   then mv -f "$(DEPDIR)/network-simple_sync.Tpo" "$(DEPDIR)/network-simple_sync.Po"; else rm -f "$(DEPDIR)/network-simple_sync.Tpo"; exit 1; fi
     320@AMDEP_TRUE@@am__fastdepCXX_FALSE@      source='simple_sync.cc' object='network-simple_sync.obj' libtool=no @AMDEPBACKSLASH@
     321@AMDEP_TRUE@@am__fastdepCXX_FALSE@      DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
     322@am__fastdepCXX_FALSE@  $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(network_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o network-simple_sync.obj `if test -f 'simple_sync.cc'; then $(CYGPATH_W) 'simple_sync.cc'; else $(CYGPATH_W) '$(srcdir)/simple_sync.cc'; fi`
    303323
    304324network-base_object.o: $(MAINSRCDIR)/lib/lang/base_object.cc
  • branches/network/src/subprojects/network/network_unit_test.cc

    r5649 r5650  
    1010#include "network_stream.h"
    1111#include "synchronizeable.h"
     12
     13#include "simple_sync.h"
    1214
    1315int verbose = 4;
     
    123125  //SDLNet_ResolveHost(&ip, "127.0.0.1", 9999);
    124126  SDLNet_ResolveHost(&ip, "localhost", 9999);
    125   Synchronizeable sync;
     127  Synchronizeable* clientSync = new SimpleSync();
     128  Synchronizeable* serverSync = new SimpleSync();
     129 
    126130 
    127131 
     
    133137
    134138  /* create a server stream */
    135   nm->createServer(sync, 9999);
     139  nm->createServer(*serverSync, 9999);
    136140 
    137141  /* esatblish a connection */
    138   nm->establishConnection(ip, sync);
     142  nm->establishConnection(ip, *clientSync);
    139143
    140144  /* synchronize the data 1 time (increment for longer tests) */
  • branches/network/src/subprojects/network/simple_sync.cc

    r5649 r5650  
     1/*
     2  orxonox - the future of 3D-vertical-scrollers
     3 
     4  Copyright (C) 2004 orx
     5 
     6  This program is free software; you can redistribute it and/or modify
     7  it under the terms of the GNU General Public License as published by
     8      the Free Software Foundation; either version 2, or (at your option)
     9      any later version.
     10 
     11### File Specific:
     12    main-programmer: Patrick Boenzli
     13    co-programmer:
     14*/
     15
     16
     17/* this is for debug output. It just says, that all calls to PRINT() belong to the DEBUG_MODULE_NETWORK module
     18          For more information refere to https://www.orxonox.net/cgi-bin/trac.cgi/wiki/DebugOutput
     19*/
     20#define DEBUG_MODULE_NETWORK
     21
     22#include "simple_sync.h"
     23
     24#include "debug.h"
     25
     26/**
     27 *  default constructor
     28 */
     29SimpleSync::SimpleSync()
     30  : Synchronizeable()
     31{
     32  this->outLength = 10;
     33  this->inLength = 0;
     34  this->outData = new byte[this->outLength];
     35 
     36  for( int i = 0; i < this->outLength; i++)
     37  {
     38    this->outData[i] = i;
     39  }
     40}
     41
     42/**
     43 *  default destructor deletes all unneded stuff
     44 */
     45SimpleSync::~SimpleSync()
     46{
     47}
     48
     49/**
     50 *  write data to NetworkStream
     51 */
     52void SimpleSync::writeBytes(byte* data, int length)
     53{
     54  /* copy the data localy */
     55  this->inLength = length;
     56  for(int i = 0; i < length; i++)
     57  {
     58    this->inData[i] = data[i];
     59  }
     60  /* and debug output */
     61  this->writeDebug();
     62}
     63
     64
     65/**
     66 *  read data from NetworkStream
     67 */
     68int SimpleSync::readBytes(byte* data)
     69{
     70  /* write the test message */
     71  data = this->outData;
     72  /* debug msg */
     73  this->readDebug();
     74  /* return the length of the test */
     75  return this->outLength;
     76}
     77
     78void SimpleSync::writeDebug()
     79{
     80  PRINTF(0)("Write in: |");
     81  for(int i = 0; i < inLength; i++)
     82  {
     83    PRINT(0)(" %i ",this->inData[i]);
     84  }
     85  PRINT(0)("|\n");
     86}
     87
     88void SimpleSync::readDebug()
     89{
     90  PRINTF(0)("Read out: |");
     91  for(int i = 0; i < outLength; i++)
     92  {
     93    PRINT(0)(" %i ",this->outData[i]);
     94  }
     95  PRINT(0)("|\n");
     96}
  • branches/network/src/subprojects/network/simple_sync.h

    r5649 r5650  
     1/*!
     2 * @file simple_sync.h
     3 *  implementation of a network sync test
     4 */
     5
     6#ifndef _SIMPLE_SYNC
     7#define _SIMPLE_SYNC
     8
     9#include "synchronizeable.h"
     10
     11
     12class SimpleSync : public Synchronizeable
     13{
     14  public:
     15    SimpleSync();
     16    ~SimpleSync();
     17 
     18    virtual void writeBytes(byte* data, int length);
     19    virtual int readBytes(byte* data);
     20   
     21  private:
     22    virtual void writeDebug();
     23    virtual void readDebug();
     24
     25   
     26  private:
     27    byte* inData;
     28    int   inLength;
     29    byte* outData;
     30    int   outLength;
     31};
     32
     33#endif /* _SIMPLE_SYNC */
     34
  • branches/network/src/subprojects/particles/Makefile.in

    r5580 r5650  
    1 # Makefile.in generated by automake 1.9.6 from Makefile.am.
     1# Makefile.in generated by automake 1.9.5 from Makefile.am.
    22# @configure_input@
    33
     
    1414
    1515@SET_MAKE@
     16
     17SOURCES = $(particles_SOURCES)
    1618
    1719srcdir = @srcdir@
  • branches/network/src/subprojects/testmain/Makefile.in

    r5580 r5650  
    1 # Makefile.in generated by automake 1.9.6 from Makefile.am.
     1# Makefile.in generated by automake 1.9.5 from Makefile.am.
    22# @configure_input@
    33
     
    1515@SET_MAKE@
    1616
     17
     18SOURCES = $(testmain_SOURCES)
    1719
    1820srcdir = @srcdir@
  • branches/network/src/util/Makefile.in

    r5580 r5650  
    1 # Makefile.in generated by automake 1.9.6 from Makefile.am.
     1# Makefile.in generated by automake 1.9.5 from Makefile.am.
    22# @configure_input@
    33
     
    1515@SET_MAKE@
    1616
     17
     18SOURCES = $(libORXutils_a_SOURCES)
    1719
    1820srcdir = @srcdir@
Note: See TracChangeset for help on using the changeset viewer.