TcpListener,TcpClient,Visual Basic 2005中的Ping [英] TcpListener, TcpClient, Ping in Visual Basic 2005

查看:89
本文介绍了TcpListener,TcpClient,Visual Basic 2005中的Ping的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一台运行Visual Basic 2005的计算机.

与在我的网络中使用TCP的其他设备进行通讯的最佳方法是什么.这些设备是条形码扫描仪和照相机.我无需按特定的顺序/顺序/定时向这些设备发送/接收消息.现在,我们正在使用TcpListener,它可以工作,但是我想使它更多地成为一个函数,我可以只传递ip,端口和文本来发送,而不是现在使用的方法,这要多一些密集编辑.

我的第二个相关问题是,监视与这些设备的通信以确保我的网络仍然健康的最佳方法是什么?现在我们使用Ping命令.

据我了解,所有Visual Basic 2005都是.NET,.NET刚刚被删除是因为从2005年开始的所有VB都是VB.NET?

感谢

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

推荐答案

我的第一个建议是:如果有可用的同步API,请不要使用任何异步API.是的,它将需要阻止调用,但是您将其放置在单独的线程中.我认为异步API通常在线程不常见的情况下具有一定意义(但仍然值得怀疑),但如今,线程已成为更简单的工作方式,更可靠和更受支持.

我提供了基于固定线程数的网络服务体系结构的示意图,请参阅我过去的答案:
来自同一端口号的多个客户端 [通过服务器触发的自动更新程序 [我如何将byte []发送到另一台PC [ ^ ],
在局域网上与两个Windows应用程序进行通信. [^ ].

—SA
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


这篇关于TcpListener,TcpClient,Visual Basic 2005中的Ping的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆