L
lncd
Unregistered / Unconfirmed
GUEST, unregistred user!
怎么动态创建的clientSocket连不上ServerSocket?代码如下:
procedure TForm1.Button1Click(Sender: TObject);
begin
ClientSocket1:=TClientSocket.Create(nil);//ClientSocket1在private中声明的
ClientSocket1.ClientType:=ctNonBlocking;//Server端采用stNonBlocking
//Client和Server端分别采用ctBlocking和stThreadBlocking就能连通,为什么?
ClientSocket1.Host:='ln';
ClientSocket1.Port:=4000;
ClientSocket1.Active:=True;
if ClientSocket1.Active then memo1.Lines.add('连接成功');//但总是连不成功
end;
procedure TForm1.Button1Click(Sender: TObject);
begin
ClientSocket1:=TClientSocket.Create(nil);//ClientSocket1在private中声明的
ClientSocket1.ClientType:=ctNonBlocking;//Server端采用stNonBlocking
//Client和Server端分别采用ctBlocking和stThreadBlocking就能连通,为什么?
ClientSocket1.Host:='ln';
ClientSocket1.Port:=4000;
ClientSocket1.Active:=True;
if ClientSocket1.Active then memo1.Lines.add('连接成功');//但总是连不成功
end;