summaryrefslogtreecommitdiff
path: root/src/syncSocketHandler.cpp
blob: 25f4c434ff8ce9b759bd9fb0bc266222b71137b9 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
//#include <sstream>
//#include <iostream>
//#include <string>
//
//#include <boost/archive/text_oarchive.hpp>
//#include <boost/archive/text_iarchive.hpp>


//#include "connectionParam.h"
//#include "Sockets/Utility.h"
#include "syncSocketHandler.h"
#include "syncListenSocket.h"
#include "syncSocket.h"
#include "connectionList.h"
//#include "buffer.h"
//#include "log.h"

SyncSocketHandler::SyncSocketHandler(SyncQueue & queue)
:SocketHandler(),queue_(queue)
{
}

int SyncSocketHandler::Select(long sec,long usec)
{
	if(!queue_.empty())
	{
		std::string sendstr = queue_.pop();
		for (socket_m::iterator it = m_sockets.begin(); it != m_sockets.end(); it++)
		{
			::SOCKETS_NAMESPACE::Socket *p = (*it).second;
			TcpSocket *p3 = dynamic_cast<TcpSocket *>(p);
			//SyncListenSocket<SyncSocket,ConnectionList> *p4 = dynamic_cast<SyncListenSocket<SyncSocket,ConnectionList> *>(p);
			if (p3)
				p3->Send(sendstr);
		}
	}
	return SocketHandler::Select(sec,usec);
}