plc如何与以太网口连接?

发布于 2025-01-13 03:23:54 字数 287 浏览 3 评论 0原文

我有一个带有以太网端口的PLC。

我想通过 TCP/IP 在 PLC 和我的 PC 之间进行连接。

怎么办呢?

using (TcpClient client = new TcpClient())
 {
   Console.WriteLine("Attempting to connect to the server ","on port 8000.");

   client.Connect(IPAddress.Parse("192.168.1.97"), 8000);
 }

I have a plc with eternet port.

I want to connect between PLC and my PC through TCP/IP.

How can it be done ?

using (TcpClient client = new TcpClient())
 {
   Console.WriteLine("Attempting to connect to the server ","on port 8000.");

   client.Connect(IPAddress.Parse("192.168.1.97"), 8000);
 }

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

晨敛清荷 2025-01-20 03:23:54

这个问题需要更多细节......但我会写一些注意事项:

  1. 现代 PLC 通常可以管理 TCP/IP 堆栈,并且大多数已经在某个端口(80?)集成了网络服务器,具体取决于您的 PLC 类型可以有一些信息并且可能访问 I/O 数据。
  2. 连接就像任何其他提供 IP 和端口地址的 TCP/IP 设备一样简单,如果套接字未连接意味着没有任何响应
  3. 如果您没有连接到 PLC 中已经工作的服务器,如注释中指出的那样应该在 PLC 程序中实现一个服务器循环来回答您的请求,您必须检查供应商文档

The question needs a bit more details... but I will write some considerations:

  1. a modern PLC typically can manage an TCP/IP stack and most has already an integrated webserver at some port (80?), depending on the kind of PLC you can have some info and maybe access to I/O data.
  2. The connection is straightforward like any other TCP/IP device providing an IP and a port address, if the socket does not connect means there is nothing responding
  3. If you are not connecting to an already working server in the PLC, as some noted in comments You should implement in the PLC program a server loop that answers to your requests, you have to check vendor documentation
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文