Click here to Skip to main content
15,607,737 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
I'm writing an application in C# where I need to communicate with appx 15 TCP/IP based barcode scanners. The scanners are set up as servers. I need a client that will listen and receive data from the servers as barcodes are scanned. There will be no sending of requests to the severs, just receive data as it is sent out. So this should be asynchronous and persistent.

What I have tried:

I have tried several asynchronous socket examples but there is always some issue such as not connecting, requiring a request to be sent to receive a response, or the examples are synchronous.
Updated 16-Aug-21 7:13am
Richard MacCutchan 16-Aug-21 12:23pm    
It would be better to make the receiver a server, which listens for connection requests from the scanners.
PIEBALDconsult 16-Aug-21 20:16pm    
The client should go get the data.

1 solution

I agree with Richard's suggestion. What you're calling a client is, in effect, a server, because it is presumably providing a service, such as updating a database. Even if it sends no application-level response to the scanners, the fact that TCP is used means that the scan gets acknowledged (and retransmitted if lost). This is effectively a response, else you'd just use UDP. But even then, I'd call it a server.
Share this answer

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900