Overview
Features
Download
Documentation
Community
Add-Ons & Services

implementing socketreactor for multithreading

Please post support and help requests here.

implementing socketreactor for multithreading

Postby thinkong » 23 Apr 2012, 22:08

hi

sorry for the noobish post but i am trying to implement a simple tcp chat server using serversocket/socketreactor/socketacceptor..

i started off with the echoserver and noticed it would only run in a single thread..

now.. i am trying to change this into a multithreaded thing so that i could possibly scale with the number of processors i have.. how would i do it?

for example.. do i create more reactors?.. or do need a new implementation to do this..?

thank you in advanced
thinkong
 
Posts: 3
Joined: 26 Mar 2012, 19:58

Re: implementing socketreactor for multithreading

Postby flomll » 15 Nov 2012, 10:58

This is realy intressting. Today I take a look at this sample and it runs realy in 2 two threads.

Thread 1: main application
Thread 2: reactor to accept new connections

The target is that every new connection start a new thread? Do have a solution now? If not maybe we can do change some ideas and test it?
flomll
 
Posts: 28
Joined: 18 May 2012, 08:58
Location: Austria

Re: implementing socketreactor for multithreading

Postby flomll » 15 Nov 2012, 11:03

I would like to implement this multithreaded because I should develope a server for some clients (>1000) at the same time. So I think this is a must have for this!!!
flomll
 
Posts: 28
Joined: 18 May 2012, 08:58
Location: Austria

Re: implementing socketreactor for multithreading

Postby flomll » 15 Nov 2012, 12:13

I read the source code from SocketReactor and SocketAcceptor and I think you have to reimplement the SocketAcceptor.

Maybe like this:
- create NewSocketAcceptor inherited by SocketAcceptor
- write own createServiceHandler() and create a new SocketReactor and ServiceHandler for every new connection.

I have tested it with 2 connections and it looks good. The only problem now is: If the connection close the ServiceHandler do not stop the thread of the own SocketReactor. I will fix this problem!
flomll
 
Posts: 28
Joined: 18 May 2012, 08:58
Location: Austria


Return to Support

Who is online

Users browsing this forum: No registered users and 2 guests