套接字接收线在Windows 11下总是为空?
我有一个线程,我要打开一个插座,并执行它,等待从另一侧接收字符串。 它在所有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 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论