Monday, 15 March 2010

c++ - Which threading model should be used to create a Feed Handler Or Adaptor -



c++ - Which threading model should be used to create a Feed Handler Or Adaptor -

hi experts out there :)

this first question here.

problem description :

i have write market info feed handler. going windows service, using 2 sockets.

socket : communication between subscribing applications , feed handler (feed handler accepting connection request , item request).

socket b : communication between feed handler , external market info provider, reuters/bloomberg.

in both cases request/response using same port.

note : volume of info coming external scheme low (external scheme send info has been subscribed for, @ point of time). later on may want scale it, providers throw data, , feed handler has filter out locally, based on subscription.

my questions :

what threading model should use? which i/o strategy should use? keeping in mind both cases, should create separate request/response thread?

edit 1: after reading few tutorials on winsock, i'm planning utilize event objects asynchronous behavior.

the point of concern here that, single thread should hear incoming client connections (accept them) , connect other server, in turn send/recv on 2 different ports.

thread 1) listening incoming connections. (continuous) 2) receiving subscribe/unsubscribe request connected clients. (rarely) 3) connect external server (onetime only). 4) forwards request coming client external server. (rarely) 5) receive info external server. (continuous) 6) send info connected clients. (continuous)

my question can single thread deed both client , server, using asynchronous i/o models?

thanks in advance. deepak

the easiest threading model seems single threaded synchronous. if need implement filter provider, implement socket-in/socket-out separate process.

c++ asynchronous winsock feeds adaptor

No comments:

Post a Comment