Click here to Skip to main content
15,074,181 members
Please Sign up or sign in to vote.
4.00/5 (1 vote)
See more:
I have a computer running Visual Basic 2005.

What is the best way to talk to other devices that use TCP in my network. These devices are Barcode scanners and Cameras. I need to send/receive messages to these devices in no particular sequence/order/timing. Right now we are using TcpListener, it works, but I'd like to make it more of a function that I can just pass the ip, port, and text to send rather than the method we use right now which is a bit more edit intensive.

My second related question is, what is the best way to monitor the communications with these devices to ensure my network is still healthy? Right now we use Ping commands.

edit: As I understand it all Visual Basic 2005 is .NET the .NET was just dropped because all VB from 2005 on is VB.NET?

Thanks
Posted
Updated 2-Jan-12 3:34am
v2
Comments
Sergey Alexandrovich Kryukov 23-Dec-11 15:09pm
   
VB or VB.NET? Please tag it properly.
--SA

1 solution

My first advice is: don't use any asynchronous APIs if a synchronous API is available. Yes, it will need blocking calls, but you place it in a separate thread. I think asynchronous APIs used to make some sense (still questionable) when threads were not a commonplace, but these days threads are much more straightforward way of doing things, more reliable and supportable.

I provided a sketch of network service architecture based on fixed number of threads, please see my past answers:
Multple clients from same port Number[^],
automatic updater triggered via server[^].

Networking can be done on few different levels. I provided my overview in these past answers:
how i can send byte[] to other pc[^],
Communication b/w two Windows applications on LAN.[^].

—SA
   
Comments
RaviRanjanKr 23-Dec-11 15:26pm
   
My 5+
Sergey Alexandrovich Kryukov 23-Dec-11 15:39pm
   
Thank you, Ravi.
--SA
Monjurul Habib 23-Dec-11 15:38pm
   
5!
Sergey Alexandrovich Kryukov 23-Dec-11 15:39pm
   
Thank you, Monjurul.
--SA

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