简体   繁体   English

为什么在设计时找不到TServerSocket类?

[英]Why TServerSocket Class not found at design-time?

In Comm_Ethernet.dfm I declare a component of type TServerSocket : Comm_Ethernet.dfm我声明了TServerSocket类型的TServerSocket

object frmCommEthernet: TfrmCommEthernet
  object ServerSocket1: TServerSocket
    Active = False
    Port = 5555
    ServerType = stNonBlocking
    OnClientConnect = ServerSocket1ClientConnect
    OnClientDisconnect = ServerSocket1ClientDisconnect
    OnClientRead = ServerSocket1ClientRead
    OnClientError = ServerSocket1ClientError
    Left = 808
    Top = 8
  end
end

TServerSocket is declared in unit System.Win.ScktComp which is in the RTL, but it doesn't seem to be available at design-time because when I open my form it complains: TServerSocket在RTL中的System.Win.ScktComp单元中声明,但在设计时似乎不可用,因为当我打开表单时它会抱怨:

TServerSocket class not found [Ignore] [Cancel] [Ignore All] 找不到TServerSocket类[忽略] [取消] [忽略所有]

However my project compiles and runs just fine (when this form is not open in the IDE). 但是,我的项目可以编译并正常运行(当未在IDE中打开此表单时)。 How do I get rid of this error? 我如何摆脱这个错误?

The components in ScktComp are deprecated and have been for a long time. ScktComp中的组件已弃用,并且使用了很长时间。 You are expected to use different components, for instance Indy. 您应该使用其他组件,例如Indy。 One strong reason for the deprecation is that these components are not cross-platform. 弃用的一个重要原因是这些组件不是跨平台的。

You can still use the ScktComp components at designtime if you install the dclsocketsNNN.bpl package into the IDE. 如果将dclsocketsNNN.bpl软件包安装到IDE中,则仍可以在ScktComp时使用ScktComp组件。 Presumably Embarcadero doesn't install this package by default because it contains deprecated components. 默认情况下,Embarcadero可能不安装此软件包,因为它包含已弃用的组件。

For whatever reason, by default, the BPL package containing this unit is not installed in the IDE. 无论出于何种原因,默认情况下,IDE中均未安装包含本机的BPL软件包。

You must go: 你必须去:

Components -> Install Packages -> Add 组件->安装软件包->添加

Then select dclsockets160.bpl in Embarcadero\\RAD Studio\\9.0\\bin (change according to your Delphi version) 然后在Embarcadero\\RAD Studio\\9.0\\bin选择dclsockets160.bpl (根据您的Delphi版本进行更改)

How to find out in whic RTL BPL package a unit is contained is a mystery to me; 如何在RTL BPL软件包中找到一个单元是一个谜。 it doesn't seem to be documented anywhere. 它似乎没有记录在任何地方。

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

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