/* orxonox - the future of 3D-vertical-scrollers Copyright (C) 2004 orx This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2, or (at your option) any later version. ### File Specific: main-programmer: claudio co-programmer: */ /* this is for debug output. It just says, that all calls to PRINT() belong to the DEBUG_MODULE_NETWORK module For more information refere to https://www.orxonox.net/cgi-bin/trac.cgi/wiki/DebugOutput */ #define DEBUG_MODULE_NETWORK #include "base_object.h" //#include "network_protocol.h" #include "network_socket.h" #include "connection_monitor.h" #include "synchronizeable.h" #include "list.h" /* include your own header */ #include "network_stream.h" /* probably unnecessary */ using namespace std; NetworkStream::NetworkStream(DataStream& inStream, DataStream& outStream) : DataStream(inStream, outStream) { this->init(); } NetworkStream::NetworkStream(Synchronizeable& sync, NetworkSocket& socket) : DataStream(sync, socket) { this->init(); } NetworkStream::NetworkStream(DataStream& inStream, NetworkSocket& socket) : DataStream(inStream, socket) { this->init(); } NetworkStream::NetworkStream(Synchronizeable& sync, DataStream& outStream) : DataStream(sync, outStream) { this->init(); } NetworkStream::NetworkStream() { this->init(); /* initialize the references */ this->networkSocket = new NetworkSocket(); this->synchronizeables = new Synchronizeable(); this->connectionMonitor = new ConnectionMonitor(); } void NetworkStream::init() { /* set the class id for the base object */ this->setClassID(CL_NETWORK_STREAM, "NetworkStream"); } NetworkStream::~NetworkStream() { delete networkSockets; delete synchronizeables; delete connectionMonitor; } void NetworkStream::processData() { byte data[10] ; // obsolete, for debugging only byte* test = (byte *)data[0]; // obsolete, for debugging only int ret = 0; this->synchronizeables->writeByteStream(NULL); ret = this->networkSockets->writeBytes(NULL,1); test = this->synchronizeables->readByteStream(); ret = this->networkSockets->readBytes(test,1); }