--- title: "Telnet 驱动程序" slug: "using-the-telnet-driver" updated: 2026-10-22T12:55:22Z published: 2026-10-22T12:55:22Z canonical: "support.tulip.co/using-the-telnet-driver" --- > ## Documentation Index > Fetch the complete documentation index at: https://support.tulip.co/llms.txt > Use this file to discover all available pages before exploring further. # Telnet 驱动程序 *Telnet 驱动程序指南* 本文介绍了 Tulip 中 Telnet 驱动程序的相关功能和配置。 ## 功能 Telnet 驱动程序允许 Tulip 应用程序连接到网络套接字并发送和接收消息。这包括但不限于使用 Telnet 协议的设备。 #### 功能 该驱动程序支持以下三个函数:* 连接* 发送* 断开 这些功能在 Tulip 应用编辑器中以“设备功能”的形式呈现,如下所示: ![](https://cdn.document360.io/7c6ff534-cad3-4fc8-9583-912c4016362f/Images/Documentation/Using%20the%20Telnet%20Driver_226546209.png) ![Using the Telnet Driver](https://cdn.document360.io/7c6ff534-cad3-4fc8-9583-912c4016362f/Images/Documentation/Using%20the%20Telnet%20Driver_226546752.png) ![Using the Telnet Driver](https://cdn.document360.io/7c6ff534-cad3-4fc8-9583-912c4016362f/Images/Documentation/Using%20the%20Telnet%20Driver_226546979.png) 这三项功能均需要将一个标识符作为参数传递。该标识符可唯一标识应用内的连接,并可用于同时维持多个连接。 “连接”函数的其他参数包括: - 主机 - 您希望连接的设备或服务的[IP 地址或](https://en.wikipedia.org/wiki/IP_address) [主机名](https://en.wikipedia.org/wiki/Hostname)。 - Port - 您要连接的设备或服务的[网络端口](https://en.wikipedia.org/wiki/Port_(computer_networking))。 - 消息终止符 - 一个可选参数,用于指定在每次调用*Send*函数后发送的一组字符,以指示消息已结束。 通常为换行符("\n")或回车加换行符("\r\n")。该终止符仅适用于通过 Send 函数发送的出站消息,不影响对入站消息的解析。 #### 事件 该驱动程序会触发两种事件:Message 事件(表示连接已发送一条消息)和 Error 事件(表示驱动程序或连接内部发生错误)。 传入的消息不会使用消息终止符或任何其他分隔符进行分割。每个“Message”事件都精确反映了从底层网络连接接收到的数据,因此消息的分割方式取决于发送设备以及任何中间网络设备。 ![](https://cdn.document360.io/7c6ff534-cad3-4fc8-9583-912c4016362f/Images/Documentation/Using%20the%20Telnet%20Driver_226547917.png) ![Using the Telnet Driver](https://cdn.document360.io/7c6ff534-cad3-4fc8-9583-912c4016362f/Images/Documentation/Using%20the%20Telnet%20Driver_226548417.png) ## 配置 除连接设备所需的 Tulip 应用逻辑外,无需进行任何配置。虽然上述示例中连接详细信息使用了静态值,但通常会从变量或 Tulip 表记录中获取这些值,以便对这些值进行集中管理。