XE8-indy10中关于TIdTCPClientCustom.Connect的源码和解读
来源:互联网 发布:windows ce6.0模拟器 编辑:程序博客网 时间:2024/06/01 10:47
TIdTCPClientCustom.Connect源码如下,中文注释是自己写的。
procedure TIdTCPClientCustom.Connect;begin if Connected then begin EIdAlreadyConnected.Toss(RSAlreadyConnected);//如果已经连接则抛出AlreadyConnected的异常 end; if Host = '' then begin EIdHostRequired.Toss('');//如果Host为空,则抛出EIdHostRequired的异常 end; if Port = 0 then begin EIdPortRequired.Toss('');//如果Host为空,则抛出EIdPortRequired的异常 end; if IOHandler = nil then begin IOHandler := MakeImplicitClientHandler; IOHandler.OnStatus := OnStatus;//改变OnStatus的状态 ManagedIOHandler := True; end; try // Bypass GetDestination if FDestination <> '' then begin IOHandler.Destination := FDestination; end;{BGO: not any more, TIdTCPClientCustom has precedence now (for port protocols, and things like that) // We retain the settings that are in here (filled in by the user) // we only do this when the iohandler has no settings, // because the iohandler has precedence if (IOHandler.Port = 0) and (IOHandler.Host = '') then begin IOHandler.Port := FPort; IOHandler.Host := FHost; end;} IOHandler.Port := FPort; //BGO: just to make sure IOHandler.Host := FHost; IOHandler.ConnectTimeout := FConnectTimeout; IOHandler.ReadTimeout := FReadTimeout; if Socket <> nil then begin Socket.BoundIP := FBoundIP; Socket.BoundPort := FBoundPort; Socket.BoundPortMin := FBoundPortMin; Socket.BoundPortMax := FBoundPortMax; Socket.IPVersion := FIPVersion; Socket.ReuseSocket := FReuseSocket; Socket.UseNagle := FUseNagle; Socket.OnBeforeBind := FOnBeforeBind; Socket.OnAfterBind := FOnAfterBind; Socket.OnSocketAllocated := FOnSocketAllocated; end; IOHandler.Open;//打开IO if IOHandler.Intercept <> nil then begin IOHandler.Intercept.Connect(Self); end; DoStatus(hsConnected, [Host]); DoOnConnected;//调用OnConnected函数 except//捕捉异常 if IOHandler <> nil then begin IOHandler.Close; if ManagedIOHandler then begin IOHandler := nil; // RLebeau - SetIOHandler() will free the IOHandler end; end; raise; end;end;
0 0
- XE8-indy10中关于TIdTCPClientCustom.Connect的源码和解读
- XE8-indy10中TIdThread.Execute函数的源码与解读
- XE8-indy10中关于Connection Closed Gracefully的源码与解读
- XE8-indy10中TIdTCPConnection.Connected函数的源码
- XE8-indy10中CheckForGracefulDisconnect函数源码
- XE8-indy10中TIdTCPClient控件Disconnect源码分析
- Indy10中idTcpServer和idTcpClient的异常解决
- C++ Builder XE8 安卓开发之indy10的线程控件如何正确调用VCL控件
- Delphi多线程和indy10 tcp的使用。
- Ibatis 关于DynamicSql源码的解读
- redux的connect解读2
- 6-spring源码3.2.18解读+spring技术内幕(关于BeanDefinition的载入和解析)
- STL中string的源码解读
- STL中string的源码解读
- JDK中Future的源码解读
- Android中Handler的源码解读
- Delphi7中安装Indy10
- 关于redis的pconnect和connect,使用中出现的问题
- yuyv_to_yv12
- 让 VLC 尽量使用 android 平台的硬件解码
- Android-Recovery Mode(recover模式详解)
- Android 性能优化之使用MAT分析内存泄露问题
- struts2的空指针异常札记
- XE8-indy10中关于TIdTCPClientCustom.Connect的源码和解读
- 机器学习之决策树生成和裁剪
- UITextView 光标置顶显示
- 在RHEL6配置IPv6 DNS Server
- Qt 5.1 下实现串口通信
- linux系统下备份多个根文件系统
- hdoj 4291 A Short problem 【找循环节 + 矩阵快速幂】
- LibMMSeg
- 改变UITextField placeHolder 字体 颜色