delphi 10.1的TSeverSocket和TClientSocket组件哪里去了,TClientSocket客户端实时发送消息

 

一、TSeverSocket和TClientSocket组件安装

转载:https://www.cnblogs.com/blogpro/p/11344639.html

delphi 7,delphi2007 delphi 2009 delphi 2010的TSeverSocket和TClientSocket组件哪里去了
   
Borland is deprecating the use of the TServerSocket 
and TClientSocket from the unit ScktComp. It is 
recommended that you use the Indy components for 
socket operations. The TServerSocket and 
TClientSocket will no longer be installed on the 
component palette by default. If you require the 
use of these components then you can install 
the design time package named dclsockets70.bpl or dclsockets100.bpl dclsockets140.bpl  , 
found in your bin directory. For deployment with 
runtime packages, you will need to deploy rtl70.bpl 
and any other required packages 
偶简单翻译了一下:TClientSocket 本来是D5默认安装的,但是D7使用的Indy组件后,就没有默认安装了,如果你喜欢这个组件,可以在delphi 7,
delphi2007 delphi 2009 delphi 2010的安装目录bin文件夹找到dclsockets70.bpl or dclsockets100.bpl dclsockets140.bpl  组件包,安装上去就OK了.
dclsockets70.bpl or dclsockets100.bpl dclsockets140.bpl  是TCientSocket和TServerSocket必需的运行包.

原文确实好文章,很多可以参考:

侵删。。

 

二、socket客户端直接发送请求:

转载:https://blog.csdn.net/newzhhsh/article/details/2905874

构造函数中创建TClientSocket,那么TClientSocket还是属于主线程,不属于     这个线程。如果你是在线程的Execute()中创建TClientSocket,那么TClientSocket属于这个线程,但是此时你无法使用OnRead来读取,

必须将TClientSocket的ClientType设为ctBlocking
 

procedure TForm1.Button3Click(Sender: TObject);
begin
  memo1.Lines.Add('111111');
  ClientSocket1.Host := 'localhost';
  ClientSocket1.Port:=9092;
  ClientSocket1.ClientType:=ctBlocking; //阻塞方式,实时发送socket消息
  ClientSocket1.Open ;
  memo1.Lines.Add('2222 open  ');
  ClientSocket1.Socket.SendText('11111111111111');
  memo1.Lines.Add('3333 send ok  ');
  ClientSocket1.Close;
  memo1.Lines.Add('4444 close end ');
end;

侵删。。

 

三、Delphi TclientSocket和TserverSocket用法(1)

里面有服务端,客户端的写法。

https://www.tuicool.com/articles/v6zEvi

 

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值