Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: orxonox.OLD/trunk/src/lib/network/server_socket.h @ 7585

Last change on this file since 7585 was 6981, checked in by bensch, 19 years ago

trunk: some virtuals

File size: 892 bytes
Line 
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
26class 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    virtual ~ServerSocket();
40    bool listen( unsigned int port );
41    NetworkSocket* getNewSocket( void );
42    void close();
43    inline bool isOk(){ return listenSocket!=NULL; }
44};
45
46#endif
Note: See TracBrowser for help on using the repository browser.