Last change
on this file since 6013 was
5996,
checked in by patrick, 19 years ago
|
orxonox/trunk: merged network branche into trunk with command svn merge -r 5824:HEAD
|
File size:
812 bytes
|
Rev | Line | |
---|
[5987] | 1 | /*! |
---|
| 2 | * @file server_socket.h |
---|
| 3 | * waits for incoming connections |
---|
| 4 | |
---|
| 5 | */ |
---|
| 6 | |
---|
| 7 | #ifndef _SERVER_SOCKET |
---|
| 8 | #define _SERVER_SOCKET |
---|
| 9 | |
---|
| 10 | #ifdef HAVE_SDL_H |
---|
| 11 | #include <SDL_thread.h> |
---|
| 12 | #else |
---|
| 13 | #include <SDL/SDL_thread.h> |
---|
| 14 | #endif |
---|
| 15 | /* include this file, it contains some default definitions */ |
---|
| 16 | #include "netdefs.h" |
---|
| 17 | |
---|
| 18 | |
---|
| 19 | /* include base_object.h since all classes are derived from this one */ |
---|
| 20 | #include "base_object.h" |
---|
| 21 | #include "network_socket.h" |
---|
| 22 | |
---|
| 23 | //sleep when waiting for connections |
---|
| 24 | #define _MSECONDS_SLEEP_LISTEN 100 |
---|
| 25 | |
---|
| 26 | class ServerSocket : public BaseObject |
---|
| 27 | { |
---|
| 28 | private: |
---|
| 29 | TCPsocket listenSocket; |
---|
| 30 | bool terminateThread; |
---|
| 31 | |
---|
| 32 | bool _isListening; |
---|
| 33 | |
---|
| 34 | void init(); |
---|
| 35 | |
---|
| 36 | public: |
---|
| 37 | ServerSocket(); |
---|
| 38 | ServerSocket( unsigned int port ); |
---|
| 39 | ~ServerSocket(); |
---|
| 40 | bool listen( unsigned int port ); |
---|
| 41 | NetworkSocket getNewSocket( void ); |
---|
| 42 | }; |
---|
| 43 | |
---|
| 44 | #endif |
---|
Note: See
TracBrowser
for help on using the repository browser.