Last change
on this file since 6903 was
6139,
checked in by patrick, 19 years ago
|
trunk: merged branche network with trunk using command: svn merge -r5999:HEAD, conflicts resolved in favor of the trunk bla
|
File size:
884 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 ); |
---|
[6139] | 41 | NetworkSocket* getNewSocket( void ); |
---|
| 42 | void close(); |
---|
| 43 | inline bool isOk(){ return listenSocket!=NULL; } |
---|
[5987] | 44 | }; |
---|
| 45 | |
---|
| 46 | #endif |
---|
Note: See
TracBrowser
for help on using the repository browser.