Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: orxonox.OLD/branches/network/src/lib/network/server_socket.h @ 7402

Last change on this file since 7402 was 7402, checked in by patrick, 18 years ago

network: server socket adapted

File size: 1.5 KB
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
26
27class ServerSocket : public BaseObject
28{
29  public:
30#warning old socket structure
31    ServerSocket();
32    ServerSocket(unsigned int port);
33
34    ServerSocket(ConnectionType connectionType);
35    ServerSocket(ConnectionType connectionType, unsigned int port );
36    virtual ~ServerSocket();
37
38    bool listen( unsigned int port );
39    NetworkSocket* getNewSocket( void );
40    void close();
41    inline bool isOk(){ return listenSocket!=NULL; }
42
43
44  private:
45    void init();
46
47
48  private:
49#warning old socket structure
50    TCPsocket         listenSocket;
51
52    ConnectionType    connectionType;                        //!< the connection type of the socket {TCP,UDP}
53    TCPsocket         listenSocketTCP;                       //!< tcp socket
54    UDPsocket         listenSocketUDP;                       //!< udp socket
55    bool              terminateThread;                       //!< true if thread terminated
56
57    bool              _isListening;                          //!< true if listening
58
59
60};
61
62#endif
Note: See TracBrowser for help on using the repository browser.