套接字接收线在Windows 11下总是为空?

发布于 2025-01-31 20:12:47 字数 765 浏览 3 评论 0原文

我有一个线程,我要打开一个插座,并执行它,等待从另一侧接收字符串。 它在所有Windows版本上都在Delphi 7上运行良好,但使用Delphi 11编译 - 它在其余的Windows版本上都可以使用,除了11。在Windows 11下,我将获得socket.receivetext.receivetext为空,并且socket.receiveLength永远是0。

TThread_Connection_Main = class( TThread )
      Socket: TCustomWinSocket;
      constructor Create(aSocket: TCustomWinSocket); overload;
      procedure Execute; override;
   end;

procedure TThread_Connection_Main.Execute;
begin
   inherited
   while Socket.Connected do
   begin
      Sleep( 2); 
      if ( Socket = nil ) or not( Socket.Connected ) then
         Break;
      if Socket.ReceiveLength < 1 then
         Continue;
    ...

   end;

end;
  • 是否有特定的操作对于Windows 11插座与Delphi 11兼容?

PS:刚刚发现该问题也存在于Delphi 10.4。

I have a thread where I am opening a socket, and executing it, waiting to receive strings from the other side.
It is working fine compiled on Delphi 7 on all Windows version, yet compiled with Delphi 11 - it working on the rest of the Windows versions, except 11. Under Windows 11 I am getting the Socket.ReceiveText to be empty and Socket.ReceiveLength to be always 0.

TThread_Connection_Main = class( TThread )
      Socket: TCustomWinSocket;
      constructor Create(aSocket: TCustomWinSocket); overload;
      procedure Execute; override;
   end;

procedure TThread_Connection_Main.Execute;
begin
   inherited
   while Socket.Connected do
   begin
      Sleep( 2); 
      if ( Socket = nil ) or not( Socket.Connected ) then
         Break;
      if Socket.ReceiveLength < 1 then
         Continue;
    ...

   end;

end;
  • Is there something specific which have to be done for Windows 11 sockets compatibility with Delphi 11 ?

P.S: Just found out that the issue exists with Delphi 10.4 as well.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文