server & client connection

git-svn-id: svn://elaine/murooma/trunk@270 d8a302eb-03bc-478d-80e4-98257eca68ef
This commit is contained in:
(no author) 2014-09-17 04:57:59 +00:00
parent d85858ac62
commit 2cf7855261
15 changed files with 184 additions and 123 deletions

View file

@ -54,6 +54,11 @@ void StreamServer::acceptor()
for (;;)
{
socket_ptr sock(new tcp::socket(io_service_));
struct timeval tv;
tv.tv_sec = 5;
tv.tv_usec = 0;
setsockopt(sock->native(), SOL_SOCKET, SO_RCVTIMEO, &tv, sizeof(tv));
setsockopt(sock->native(), SOL_SOCKET, SO_SNDTIMEO, &tv, sizeof(tv));
a.accept(*sock);
cout << "StreamServer::New connection: " << sock->remote_endpoint().address().to_string() << "\n";
StreamSession* session = new StreamSession(sock);