VR-Forces Development_Version Class Documentation
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
DtTcpServer.h
Go to the documentation of this file.
1 /*******************************************************************************
2 ** Copyright (c) 2015 MAK Technologies, Inc.
3 ** All rights reserved.
4 *******************************************************************************/
5 /*******************************************************************************
6 ** $RCSfile: DtTcpServer.h,v $ $Revision: 1.25 $ $State: Exp $
7 *******************************************************************************/
8 
12 
13 #ifndef DtIGITCPServer_H_
14 #define DtIGITCPServer_H_
15 
16 #include <vrvCore/vrvCore.h>
17 
18 #include <list>
19 #include <string>
20 
21 #ifdef _WIN32
22 struct fd_set;
23 #else
24 #include <sys/types.h>
25 #endif
26 
27 
28 namespace makVrv
29 {
30  class DtDe;
31  class DtMessageDispatcher;
32  class DtTcpMessageClient;
33 
37  {
38  public:
39 
40  typedef std::list<DtTcpMessageClient*> ClientList;
41 
42  static const std::string theServerHandshake;
43  static const std::string theClientHandshake;
44 
46  DtTcpServer(DtDe& de,int port);
47 
49  ~DtTcpServer();
50 
52  bool isListening() const;
53 
55  void startListening();
56 
58  void stopListening();
59 
61  int numberOfConnections();
62 
64  void cleanupDisconnectedClients();
65 
67  void checkForMessages();
68 
72  void addClient(DtTcpMessageClient*);
73 
75  const ClientList& clients() const;
76 
78  void deleteClient(DtTcpMessageClient*);
79 
81  DtTcpMessageClient* findClient(const std::string& name);
82 
84  void deleteClients();
85 
87  static void setBlocking(int fd, bool blocking);
88 
89  protected:
90 
92  void handleNewConnections();
93 
95  void buildSocketList();
96 
98  void processReads();
99 
100 
102  int mySocket;
104  int myPort;
105  fd_set* myReceiveSet;
106 
109  };
110 }
111 
112 #endif

Document ID: Generated on Mon Jul 4 01:00:18 EDT 2016 from SVN revision 166489
Copyright © 2005-2015 VT MÄK. All Rights Reserved (www.mak.com)