35 yCDebug(TCPFACE,
"opening for address %s", address.
toURI().c_str());
37 this->address = address;
39 ACE_INET_Addr serverAddr((address.
getPort() > 0) ? address.
getPort() : 0);
40 int result = peerAcceptor.open(serverAddr, 1);
42 ACE_INET_Addr localAddr;
43 peerAcceptor.get_local_addr(localAddr);
44 this->address = address;
47 localAddr.get_port_number());
50 int result = peerAcceptor.open(address);
52 this->address = address;
55 peerAcceptor.get_port_number());
58 yCDebug(TCPFACE,
"Opened at address %s", this->address.
toURI().c_str());
68 void TcpFace::closeFace()
70 if (address.isValid()) {
79 yCError(TCPFACE,
"Authentication failed.");
80 yCError(TCPFACE,
"Authentication was enabled in the auth.conf file.");
81 yCError(TCPFACE,
"If you do not want to use authentication, please");
82 yCError(TCPFACE,
"remove this file.");
83 yCError(TCPFACE,
"If you do want to set up authentication, check:");
84 yCError(TCPFACE,
" http://www.yarp.it/yarp_port_auth.html");
93 yCAssert(TCPFACE, stream !=
nullptr);
95 int result = stream->open(peerAcceptor);
103 if (stream !=
nullptr) {
104 stream->setReadTimeout(2.0);
105 stream->setWriteTimeout(2.0);
107 bool success = auth.authSource(&(stream->getInputStream()), &(stream->getOutputStream()));
112 stream->setReadTimeout(0.);
113 stream->setWriteTimeout(0.);
123 int result = stream->open(address);
130 if (stream !=
nullptr) {
131 stream->setReadTimeout(2.0);
132 stream->setWriteTimeout(2.0);
134 bool success = auth.authDest(&(stream->getInputStream()), &(stream->getOutputStream()));
139 stream->setReadTimeout(0.);
140 stream->setWriteTimeout(0.);
The output side of an active connection between two ports.
static std::string getHostName(bool prefer_loopback=false, const std::string &seed="")
Connection choreographer.
A stream abstraction for socket communication.
InputProtocol * read() override
return nullptr on failure.
Contact getLocalAddress() const override
Get address after open(), if more specific that the address provided to open() - otherwise an invalid...
bool open(const Contact &address) override
Start listening to the given address.
void close() override
Stop listening.
OutputProtocol * write(const Contact &address) override
Try to reach out and talk to someone.
#define yCError(component,...)
#define yCAssert(component, x)
#define yCDebug(component,...)
#define YARP_OS_LOG_COMPONENT(name, name_string)
The components from which ports and connections are built.
An interface to the operating system, including Port based communication.