Overview
Features
Download
Documentation
Community
Add-Ons & Services

How to combine a ThreadPool and a TCPServer?

Please post support and help requests here.

How to combine a ThreadPool and a TCPServer?

Postby Sylva1n » 13 Dec 2012, 23:17

Hello,

I would like to launch a TCPServer in a thread using ThreadPool.

I tried:

Code: Select all
ServerSocket svs(port);
TCPServer srv(new MyServerConnectionFactory(), svs);

ThreadPool pool;

pool.start(srv);

waitForTerminationRequest();


srv.stop();

pool.joinAll();


It doesn't work (of course, the ConnectionFactory is implemented).

Where is the mistake?

Best regards,

Sylvain
Sylva1n
 
Posts: 4
Joined: 12 Dec 2012, 23:56

Re: How to combine a ThreadPool and a TCPServer?

Postby alex » 13 Dec 2012, 23:39

Sylva1n wrote:Where is the mistake?

TCPServer has a TCPServerDispatcher member which has a built-in ThreadPool.
Code: Select all
ServerSocket svs(port);
TCPServer srv(new MyServerConnectionFactory(format), svs);
srv.start();
waitForTerminationRequest();
srv.stop();
alex
 
Posts: 1145
Joined: 11 Jul 2006, 16:27
Location: United_States


Return to Support

Who is online

Users browsing this forum: No registered users and 2 guests

cron