Last change
on this file since 6007 was
6007,
checked in by rennerc, 18 years ago
|
network_stream: added possibility to connect to >1 hosts
|
File size:
1.2 KB
|
Line | |
---|
1 | /*! |
---|
2 | * @file network_stream.h |
---|
3 | * implementation of a network pipe |
---|
4 | */ |
---|
5 | |
---|
6 | #ifndef _NETWORK_STREAM |
---|
7 | #define _NETWORK_STREAM |
---|
8 | |
---|
9 | #include <vector> |
---|
10 | #include <list> |
---|
11 | |
---|
12 | #include "data_stream.h" |
---|
13 | #include "network_protocol.h" |
---|
14 | #include "server_socket.h" |
---|
15 | |
---|
16 | class Synchronizeable; |
---|
17 | class NetworkSocket; |
---|
18 | class ServerSocket; |
---|
19 | class ConnectionMonitor; |
---|
20 | class NetworkProtocol; |
---|
21 | |
---|
22 | typedef std::list<Synchronizeable*> SynchronizeableList; |
---|
23 | typedef std::vector<NetworkSocket*> NetworkSocketVector; |
---|
24 | |
---|
25 | |
---|
26 | class NetworkStream : public DataStream |
---|
27 | { |
---|
28 | |
---|
29 | public: |
---|
30 | NetworkStream(); |
---|
31 | NetworkStream(IPaddress& address); |
---|
32 | NetworkStream(unsigned int port); |
---|
33 | |
---|
34 | ~NetworkStream(); |
---|
35 | void init(); |
---|
36 | |
---|
37 | void connectSynchronizeable(Synchronizeable& sync); |
---|
38 | |
---|
39 | inline bool isServer() const { return (this->type == NET_SERVER)? true:false; } |
---|
40 | inline bool isActive() const { return this->bActive; } |
---|
41 | |
---|
42 | virtual void processData(); |
---|
43 | |
---|
44 | private: |
---|
45 | NetworkProtocol* networkProtocol; |
---|
46 | ConnectionMonitor* connectionMonitor; |
---|
47 | SynchronizeableList synchronizeables; |
---|
48 | NetworkSocketVector networkSockets; |
---|
49 | ServerSocket* serverSocket; |
---|
50 | int type; |
---|
51 | Header packetHeader; |
---|
52 | bool bActive; |
---|
53 | }; |
---|
54 | #endif /* _NETWORK_STREAM */ |
---|
Note: See
TracBrowser
for help on using the repository browser.