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 your own header */ |
---|
24 | #include "network_stream.h" |
---|
25 | |
---|
26 | /* probably unnecessary */ |
---|
27 | using namespace std; |
---|
28 | |
---|
29 | |
---|
30 | NetworkStream::NetworkStream() |
---|
31 | { |
---|
32 | /* set the class id for the base object */ |
---|
33 | this->setClassID(CL_NETWORK_STREAM, "NetworkStream"); |
---|
34 | |
---|
35 | /* initialize the references */ |
---|
36 | this->networkSockets = new NetworkSocket(); |
---|
37 | this->synchronizeables = new Synchronizeable(); |
---|
38 | this->connectionMonitor = new ConnectionMonitor(); |
---|
39 | |
---|
40 | |
---|
41 | |
---|
42 | } |
---|
43 | |
---|
44 | NetworkStream::~NetworkStream() |
---|
45 | { |
---|
46 | delete networkSockets; |
---|
47 | delete synchronizeables; |
---|
48 | delete connectionMonitor; |
---|
49 | |
---|
50 | } |
---|
51 | |
---|
52 | void NetworkStream::processData() |
---|
53 | { |
---|
54 | byte data[10] ; // obsolete, for debugging only |
---|
55 | byte* test = (byte *)data[0]; // obsolete, for debugging only |
---|
56 | int ret = 0; |
---|
57 | this->synchronizeables->writeByteStream(NULL); |
---|
58 | ret = this->networkSockets->writeBytes(NULL,1); |
---|
59 | test = this->synchronizeables->readByteStream(); |
---|
60 | ret = this->networkSockets->readBytes(test,1); |
---|
61 | } |
---|
62 | |
---|