Asynchronous Socket Server

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
 
V

Vadym Stetsyak

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top