简体   繁体   English

C# 将客户端(本地窗体应用程序)连接到通过以太网连接到计算机的控制器

[英]C# Connecting client (local windows form application) to controller connected to computer via ethernet

I need to create a user interface to control a tool that is connected directly to my computer via an Ethernet cable.我需要创建一个用户界面来控制通过以太网电缆直接连接到我的计算机的工具。 The controller is listening at a specified socket for connection requests.控制器在指定的套接字上侦听连接请求。

When the connection is made the controller will broadcast streams of data.建立连接后,控制器将广播数据流。

I am currently looking to use client code similar to this example ( https://msdn.microsoft.com/en-us/library/bbx2eya8(v=vs.110).aspx )我目前希望使用类似于此示例的客户端代码( https://msdn.microsoft.com/en-us/library/bbx2eya8(v=vs.110).aspx

If I knew the IP address and the port number, would i be able to accomplish this connection?如果我知道 IP 地址和端口号,我是否能够完成此连接? I'm new to socket programming so I'm not sure if this a good way to go about it.我是套接字编程的新手,所以我不确定这是否是一个好方法。

If this controller is listening for socket connections and the application doesn't listen for incoming connection requests you only need a TcpClient object to start the communication.如果此控制器正在侦听套接字连接并且应用程序不侦听传入的连接请求,则您只需要一个TcpClient对象来启动通信。

Here is a basic sample .这是一个基本 示例

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM