I just started using POCO for the networking library and I ran into an issue with compiling my code. I have a templated class, MySocketAcceptor that inherits from SocketAcceptor. I overload the createServiceHandler function with hopes of doing something in there, but I cannot compile it.
- Code: Select all
template <class MyTemplate> class MySocketAcceptor : public SocketAcceptor<MySocket<MyTemplate>>
{
public:
MySocketAcceptor (MyServerr<MyTemplate> & server, ServerSocket & socket, SocketReactor & reactor) : SocketAcceptor<MySocket<MyTemplate>>(socket, reactor), m_server(server), m_reactor(reactor)
{
}
protected:
MySocket<MyTemplate> * createServiceHandler(StreamSocket & socket)
{
MySocket<MyTemplate> * conn = new MySocket<MyTemplate>(socket, m_reactor, m_server);
m_server.RegisterClientConnection(conn);
return conn;
}
private:
MyServer<MyTemplate> & m_server;
SocketReactor & m_reactor;
};
When compiling this code, I get the following error : "error C2661: 'MySocket<MyTemplate>::MySocket' : no overloaded function takes 2 arguments c:\source\include\poco\net\socketacceptor.h 153". It refers to the following in socketaccpetor.h:
- Code: Select all
virtual ServiceHandler* createServiceHandler(StreamSocket& socket)
/// Create and initialize a new ServiceHandler instance.
///
/// Subclasses can override this method.
{
return new ServiceHandler(socket, *_pReactor);
}
Can anyone offer some guidance to a first time user? Any suggestions will be appreciated.





