Asynchronous Socket Server

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hi,

I am implementing an asynchronous socket server in my application. It will
take data from connected clients and put it into a thread safe array that
other threads in my application use.

I need to allow other threads in my application to communicate with the
Socket server to send data back to the clients.

I'm not sure what the most efficent method is to do this.

Can anyone give me any advice?

Thanks In Advance
Macca
 
Hello, Macca!

M> I am implementing an asynchronous socket server in my application. It
M> will take data from connected clients and put it into a thread safe
M> array that other threads in my application use.

M> I need to allow other threads in my application to communicate with the
M> Socket server to send data back to the clients.

M> I'm not sure what the most efficent method is to do this.

As you have array list for received data you can introduce thread safe queue, where thread will put info that is required to be sent over network. Events (AutoResetEvent) can be use to introduce notification mechanism.

This approach will introduce monitoring thread that will wait on the event, if event is signaled it will send data put into the queue...

--
Regards, Vadym Stetsyak
www: http://vadmyst.blogspot.com
 
Back
Top