TcpClients and Threads

J

Jerry Spence1

I am currently looking at writing a TCP client for talking to a number of
networked card readers. With Vb.Net, the process hangs pending an input. To
overcome this problem I am using the ThreadPool class and spawning a thread
for the TCPClient to wait for an input, which I then process.

However I want to design the software to cope with a large number of readers
(say 100). Is there any problem with me creating 100 threads and 100
TCPClients, all of which will sit there waiting for someone to swipe a card?
I haven't a feel for whether 100 threads is a lot or not.

- Jerry
 
T

Tom Shelton

I am currently looking at writing a TCP client for talking to a number of
networked card readers. With Vb.Net, the process hangs pending an input. To
overcome this problem I am using the ThreadPool class and spawning a thread
for the TCPClient to wait for an input, which I then process.

However I want to design the software to cope with a large number of readers
(say 100). Is there any problem with me creating 100 threads and 100
TCPClients, all of which will sit there waiting for someone to swipe a card?
I haven't a feel for whether 100 threads is a lot or not.

- Jerry

Jerry...

To be honest, I would dump TCPClient and just use the socket class from
System.Net.Sockets. I would then use it's async methods to read and
write data. It's much more efficient this way.

here is a good place to start for .NET socket programming:
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpguide/html/cpconsockets.asp

HTH
 

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