DeviceTcpNetConnectServer 方法 (AlienSession) |
使用指定的套接字创建异形客户端,在异形客户端的模式下,网络通道需要被动创建。
Use the specified socket to create the alien client. In the alien client mode, the network channel needs to be created passively.
命名空间:
HslCommunication.Core.Device
程序集:
HslCommunication (在 HslCommunication.dll 中) 版本:12.0.3.0 (12.0.3.0)
语法public OperateResult ConnectServer(
AlienSession session
)
Public Function ConnectServer (
session As AlienSession
) As OperateResult
public:
OperateResult^ ConnectServer(
AlienSession^ session
)
member ConnectServer :
session : AlienSession -> OperateResult
参数
- session
- 类型:HslCommunication.Core.NetAlienSession
异形客户端对象,查看类型创建的客户端
返回值
类型:
OperateResult通常都为成功
备注
不能和之前的长连接和短连接混用,详细参考 Demo程序
示例
简单的创建示例。
client.ConnectServer( session );
如果想知道是否创建成功。通常都是成功。
OperateResult connect = client.ConnectServer( session );
if (connect.IsSuccess)
{
Console.WriteLine( "connect success" );
}
else
{
Console.WriteLine( "connect failed" );
}
参见