WPILibC++
2020.3.2
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 (c) 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 WPIUTIL_WPI_TCPACCEPTOR_H_
25
#define WPIUTIL_WPI_TCPACCEPTOR_H_
26
27
#include <atomic>
28
#include <memory>
29
#include <string>
30
31
#include "wpi/NetworkAcceptor.h"
32
#include "wpi/TCPStream.h"
33
34
namespace
wpi
{
35
36
class
Logger;
37
38
class
TCPAcceptor
:
public
NetworkAcceptor
{
39
int
m_lsd;
40
int
m_port;
41
std::string m_address;
42
bool
m_listening;
43
std::atomic_bool m_shutdown;
44
Logger
& m_logger;
45
46
public
:
47
TCPAcceptor
(
int
port,
const
char
* address,
Logger
& logger);
48
~
TCPAcceptor
();
49
50
int
start()
override
;
51
void
shutdown()
override
;
52
std::unique_ptr<NetworkStream> accept()
override
;
53
};
54
55
}
// namespace wpi
56
57
#endif // WPIUTIL_WPI_TCPACCEPTOR_H_
wpi::TCPAcceptor
Definition:
TCPAcceptor.h:38
wpi::NetworkAcceptor
Definition:
NetworkAcceptor.h:17
wpi::Logger
Definition:
Logger.h:30
wpi
WPILib C++ utilities (wpiutil) namespace.
Definition:
EventLoopRunner.h:17
wpiutil
src
main
native
include
wpi
TCPAcceptor.h
Generated on Fri Feb 21 2020 08:50:37 for WPILibC++ by
1.8.16