Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: orxonox.OLD/branches/network/src/lib/network/network_stream.cc @ 5647

Last change on this file since 5647 was 5647, checked in by patrick, 18 years ago

network: modiefied the unit test to enable diffrent modes, extended the NetworkStream constructors interface and NetworkManager interface

File size: 2.2 KB
Line 
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: claudio
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
23#include "base_object.h"
24//#include "network_protocol.h"
25#include "network_socket.h"
26#include "connection_monitor.h"
27#include "synchronizeable.h"
28#include "list.h"
29
30
31/* include your own header */
32#include "network_stream.h"
33
34/* probably unnecessary */
35using namespace std;
36
37
38NetworkStream::NetworkStream(DataStream& inStream, DataStream& outStream) 
39  : DataStream(inStream, outStream)
40{
41  this->init();
42}
43
44NetworkStream::NetworkStream(Synchronizeable& sync, NetworkSocket& socket) 
45  : DataStream(sync, socket)
46{
47  this->init();
48}
49
50NetworkStream::NetworkStream(DataStream& inStream, NetworkSocket& socket) 
51  : DataStream(inStream, socket)
52{
53  this->init();
54}
55
56NetworkStream::NetworkStream(Synchronizeable& sync, DataStream& outStream) 
57  : DataStream(sync, outStream)
58{
59  this->init();
60}
61
62NetworkStream::NetworkStream()
63{
64  this->init();
65  /* initialize the references */
66  this->networkSocket = new NetworkSocket();
67  this->synchronizeables = new Synchronizeable();
68  this->connectionMonitor = new ConnectionMonitor();
69}
70
71
72void NetworkStream::init()
73{
74  /* set the class id for the base object */
75  this->setClassID(CL_NETWORK_STREAM, "NetworkStream");
76}
77
78
79NetworkStream::~NetworkStream()
80{
81 delete networkSockets;
82 delete synchronizeables;
83 delete connectionMonitor;
84
85}
86
87void NetworkStream::processData()
88{
89  byte data[10] ; // obsolete, for debugging only
90  byte* test = (byte *)data[0]; // obsolete, for debugging only
91  int ret = 0;
92  this->synchronizeables->writeByteStream(NULL);
93  ret = this->networkSockets->writeBytes(NULL,1);
94  test = this->synchronizeables->readByteStream();
95  ret = this->networkSockets->readBytes(test,1);
96}
97
Note: See TracBrowser for help on using the repository browser.