VR-Vantage API Documentation
DtTcpServer.h
Go to the documentation of this file.
1 /*******************************************************************************
2 ** Copyright (c) 2009 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 checkForMessages();
65 
69  void addClient(DtTcpMessageClient*);
70 
72  const ClientList& clients() const;
73 
75  void deleteClient(DtTcpMessageClient*);
76 
78  DtTcpMessageClient* findClient(const std::string& name);
79 
81  void deleteClients();
82 
84  static void setBlocking(int fd, bool blocking);
85 
86  protected:
87 
89  void handleNewConnections();
90 
92  void buildSocketList();
93 
95  void processReads();
96 
97 
99  int mySocket;
101  int myPort;
102  fd_set* myReceiveSet;
103 
106  };
107 }
108 
109 #endif


Copyright © 2005-2013 VT MÄK Inc. All Rights Reserved (www.mak.com)