VR-Forces Developer's Guide
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
DtTcpServer.h
Go to the documentation of this file.
1 /*******************************************************************************
2 ** Copyright (c) 2017 MAK Technologies, Inc.
3 ** All rights reserved.
4 *******************************************************************************/
5 
9 
10 #ifndef DtIGITCPServer_H_
11 #define DtIGITCPServer_H_
12 
13 #include <vrvCore/vrvCore.h>
14 
15 #include <list>
16 #include <string>
17 
18 #ifdef _WIN32
19 struct fd_set;
20 #else
21 #include <sys/types.h>
22 #endif
23 
24 
25 namespace makVrv
26 {
27  class DtDe;
28  class DtMessageDispatcher;
29  class DtTcpMessageClient;
30 
34  {
35  public:
36 
37  typedef std::list<DtTcpMessageClient*> ClientList;
38 
39  static const std::string theServerHandshake;
40  static const std::string theClientHandshake;
41 
43  DtTcpServer(DtDe& de,int port);
44 
46  ~DtTcpServer();
47 
49  bool isListening() const;
50 
52  void startListening();
53 
55  void stopListening();
56 
58  int numberOfConnections();
59 
61  void cleanupDisconnectedClients();
62 
64  void checkForMessages();
65 
69  void addClient(DtTcpMessageClient*);
70 
72  const ClientList& clients() const;
73 
75  void deleteClient(DtTcpMessageClient* client, bool lostConnection=false);
76 
78  DtTcpMessageClient* findClient(const std::string& name);
79 
81  void deleteClients();
82 
84  static void setBlocking(int fd, bool blocking);
85 
86 #ifdef USE_IN_MEMORY_PROFILER
87  void startProfiler();
88 #endif
89 
90  protected:
91 
93  void handleNewConnections();
94 
96  void buildSocketList();
97 
99  void processReads();
100 
101 
103  int mySocket;
105  int myPort;
106  fd_set* myReceiveSet;
107 
110  };
111 }
112 
113 #endif
std::list< DtTcpMessageClient * > ClientList
Definition: DtTcpServer.h:37
static const std::string theClientHandshake
Definition: DtTcpServer.h:40
int mySocket
Definition: DtTcpServer.h:103
fd_set * myReceiveSet
Definition: DtTcpServer.h:106
A remote TCP client that the TCP server communicates with.
Definition: DtTcpMessageClient.h:26
int myPort
Definition: DtTcpServer.h:105
DtDe & myDe
Definition: DtTcpServer.h:102
#define DT_DLL_VRVCORE
Definition: vrvCore.h:20
ClientList myClients
Definition: DtTcpServer.h:108
static const std::string theServerHandshake
Definition: DtTcpServer.h:39
int myHighSocket
Definition: DtTcpServer.h:104
DtMessageDispatcher & myDispatcher
Definition: DtTcpServer.h:109
IGI Manager managers both IGI clients and IGI interfaces.
Definition: DtMessageDispatcher.h:31
The DtDe is the core component of any VR-Vantage application. It owns a DtRenderer, DtDeCommunicator, as well as a DtDisplay and other things.
Definition: DtDe.h:76
This is used by the master to connect to slaves.
Definition: DtTcpServer.h:33
Contains DLL export macros.

Document ID: Generated on Thu Oct 23 22:29:17 EDT 2025 from SVN revision 280951
Copyright © 2005-2024 MAK Technologies. All Rights Reserved (www.mak.com)