TcpClients and Threads

  • Thread starter Thread starter Jerry Spence1
  • Start date Start date
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
 
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
 
Back
Top