本文整理汇总了C++中StreamSocket::impl方法的典型用法代码示例。如果您正苦于以下问题:C++ StreamSocket::impl方法的具体用法?C++ StreamSocket::impl怎么用?C++ StreamSocket::impl使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类StreamSocket
的用法示例。
在下文中一共展示了StreamSocket::impl方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: acceptConnection
SocketImpl* SecureSocketImpl::acceptConnection(SocketAddress& clientAddr)
{
poco_assert (!_pSSL);
StreamSocket ss = _pSocket->acceptConnection(clientAddr);
Poco::AutoPtr<SecureStreamSocketImpl> pSecureStreamSocketImpl = new SecureStreamSocketImpl(static_cast<StreamSocketImpl*>(ss.impl()), _pContext);
pSecureStreamSocketImpl->acceptSSL();
pSecureStreamSocketImpl->duplicate();
return pSecureStreamSocketImpl;
}
示例2: attach
SecureStreamSocket SecureStreamSocket::attach(const StreamSocket& streamSocket, const std::string& peerHostName, Context::Ptr pContext, Session::Ptr pSession)
{
SecureStreamSocketImpl* pImpl = new SecureStreamSocketImpl(static_cast<StreamSocketImpl*>(streamSocket.impl()), pContext);
SecureStreamSocket result(pImpl);
result.setPeerHostName(peerHostName);
result.useSession(pSession);
pImpl->connectSSL();
return result;
}
示例3: run
void HTTPSTestServer::run()
{
_ready.set();
Poco::Timespan span(250000);
while (!_stop)
{
if (_socket.poll(span, Socket::SELECT_READ))
{
StreamSocket ss = _socket.acceptConnection();
try
{
_lastRequest.clear();
char buffer[256];
int n = ss.receiveBytes(buffer, sizeof(buffer));
while (n > 0 && !_stop)
{
_lastRequest.append(buffer, n);
if (!requestComplete())
n = ss.receiveBytes(buffer, sizeof(buffer));
else
n = 0;
}
std::string response = handleRequest();
ss.sendBytes(response.data(), (int) response.size());
if(_lastRequest.find("/connection/abort")!=std::string::npos) {
SecureStreamSocketImpl* sss = dynamic_cast<SecureStreamSocketImpl*>(ss.impl());
if(sss!=NULL) sss->abort();
}
Poco::Thread::sleep(1000);
}
catch (Poco::Exception& exc)
{
std::cerr << "HTTPSTestServer: " << exc.displayText() << std::endl;
}
}
}
}