00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00025
00026 #ifndef RemoteTCPServer_H
00027 #define RemoteTCPServer_H
00028
00029 #include "H3DNetworkingUtils/RemoteServer.h"
00030
00031
00032
00033
00034 template struct __declspec(dllimport) H3D::AutoUpdate <H3D::SFBool>;
00035
00036 namespace H3DNetworkingUtils {
00037
00050
00051 class H3D_NETWORKING_UTILS_DLL_SPEC RemoteTCPServer : public RemoteServer {
00052 public:
00053
00055 RemoteTCPServer();
00056
00058 virtual ~RemoteTCPServer();
00059
00061 static H3D::H3DNodeDatabase database;
00062
00063 protected:
00064
00066 virtual void startServer(int port_number);
00067
00069 virtual void startReceiving();
00070
00072 virtual void listeningLoop();
00073
00077 struct ListenData {
00078 int port;
00079 bool periodic_send;
00080 };
00081
00082 static void listeningThread(void * client_data) {
00083 static_cast<RemoteTCPServer*>(client_data)->listeningLoop();
00084 }
00085
00087 bool listeningLoopRunning();
00088
00090 void setListeningLoopRunning(bool v);
00091
00093 void stopListeningThread();
00094
00095 bool keepListening();
00096
00097 private:
00098 Thread * listening_threadP;
00099 ListenData listen_data;
00100
00101
00102 bool periodic_snd;
00103
00104
00105 bool stop_listening_thread;
00106 bool listening_loop_running;
00107 Mutex listening_loop_lock;
00108 };
00109
00110 }
00111
00112 #endif