WPILibC++  unspecified
 All Classes Files Functions Variables Typedefs Enumerations Enumerator Pages
TCPAcceptor.h
1 /*
2  TCPAcceptor.h
3 
4  TCPAcceptor class interface. TCPAcceptor provides methods to passively
5  establish TCP/IP connections with clients.
6 
7  ------------------------------------------
8 
9  Copyright © 2013 [Vic Hargrave - http://vichargrave.com]
10 
11  Licensed under the Apache License, Version 2.0 (the "License");
12  you may not use this file except in compliance with the License.
13  You may obtain a copy of the License at
14 
15  http://www.apache.org/licenses/LICENSE-2.0
16 
17  Unless required by applicable law or agreed to in writing, software
18  distributed under the License is distributed on an "AS IS" BASIS,
19  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
20  See the License for the specific language governing permissions and
21  limitations under the License.
22 */
23 
24 #ifndef TCPSOCKETS_TCPACCEPTOR_H_
25 #define TCPSOCKETS_TCPACCEPTOR_H_
26 
27 #include <atomic>
28 #include <memory>
29 #include <string>
30 
31 #include "NetworkAcceptor.h"
32 #include "TCPStream.h"
33 
34 class TCPAcceptor : public NetworkAcceptor {
35  int m_lsd;
36  int m_port;
37  std::string m_address;
38  bool m_listening;
39  std::atomic_bool m_shutdown;
40 
41  public:
42  TCPAcceptor(int port, const char* address);
43  ~TCPAcceptor();
44 
45  int start() override;
46  void shutdown() override;
47  std::unique_ptr<NetworkStream> accept() override;
48 };
49 
50 #endif
Definition: NetworkAcceptor.h:13
Definition: TCPAcceptor.h:34