当前位置: 首页>>代码示例>>C++>>正文


C++ StreamSocket::peerAddress方法代码示例

本文整理汇总了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());
}
开发者ID:Alcibiades586,项目名称:roadrunner,代码行数:11,代码来源:SocketTest.cpp

示例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());
}
开发者ID:RobertoMalatesta,项目名称:sandbox,代码行数:13,代码来源:LocalSocketTest.cpp

示例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);
	}
开发者ID:cshnick,项目名称:CommunicationModel,代码行数:15,代码来源:EchoServer.cpp

示例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));
	}
开发者ID:thinkunion,项目名称:gjdx,代码行数:16,代码来源:main.cpp

示例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();
}
开发者ID:191919,项目名称:Cumulus,代码行数:3,代码来源:ServerConnection.cpp


注:本文中的StreamSocket::peerAddress方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。