本文整理汇总了C++中StreamSocket::peerAddress方法的典型用法代码示例。如果您正苦于以下问题:C++ StreamSocket::peerAddress方法的具体用法?C++ StreamSocket::peerAddress怎么用?C++ StreamSocket::peerAddress使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类StreamSocket
的用法示例。
在下文中一共展示了StreamSocket::peerAddress方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: testAddress
void SocketTest::testAddress()
{
ServerSocket serv;
serv.bind(SocketAddress());
serv.listen();
StreamSocket ss;
ss.connect(SocketAddress("localhost", serv.address().port()));
StreamSocket css = serv.acceptConnection();
assert (css.peerAddress().host() == ss.address().host());
assert (css.peerAddress().port() == ss.address().port());
}
示例2: testAddress
void LocalSocketTest::testAddress()
{
SocketAddress sas("/tmp/poco.server.tcp.sock");
ServerSocket serv;
serv.bind(sas);
serv.listen();
StreamSocket ss;
SocketAddress sac("/tmp/poco.client.tcp.sock");
ss.connect(sas, &sac);
StreamSocket css = serv.acceptConnection();
assert (css.peerAddress().host() == ss.address().host());
assert (css.peerAddress().port() == ss.address().port());
}
示例3: delegate
EchoServiceHandler(StreamSocket& socket, SocketReactor& reactor):
_socket(socket),
_reactor(reactor),
_fifoIn(BUFFER_SIZE, true),
_fifoOut(BUFFER_SIZE, true)
{
Application& app = Application::instance();
app.logger().information("Connection from " + socket.peerAddress().toString());
_reactor.addEventHandler(_socket, NObserver<EchoServiceHandler, ReadableNotification>(*this, &EchoServiceHandler::onSocketReadable));
_reactor.addEventHandler(_socket, NObserver<EchoServiceHandler, ShutdownNotification>(*this, &EchoServiceHandler::onSocketShutdown));
_fifoOut.readable += delegate(this, &EchoServiceHandler::onFIFOOutReadable);
_fifoIn.writable += delegate(this, &EchoServiceHandler::onFIFOInWritable);
}
示例4: ts
EchoServiceHandler(StreamSocket& socket, SocketReactor& reactor):
_socket(socket),
_reactor(reactor),
_recvBuffer(new unsigned char[BUFFER_SIZE]),
_sendBuffer(new unsigned char[BUFFER_SIZE])
{
Application& app = Application::instance();
Timespan ts(20,0);
socket.setReceiveTimeout(ts);
app.logger().information("Connection from " + socket.peerAddress().toString());
_reactor.addEventHandler(_socket, NObserver<EchoServiceHandler, ReadableNotification>(*this, &EchoServiceHandler::onReadable));
_reactor.addEventHandler(_socket, NObserver<EchoServiceHandler, ShutdownNotification>(*this, &EchoServiceHandler::onShutdown));
}
示例5: address
ServerConnection::ServerConnection(const StreamSocket& socket,SocketManager& socketManager,ServerHandler& handler,ServersHandler& serversHandler) : address(socket.peerAddress().toString()),_size(0),_handler(handler),TCPClient(socket,socketManager),_connected(false),_serversHandler(serversHandler),isTarget(false) {
sendPublicAddress();
}