TMyThread = Class(TThread)
privat
clientSocket:TClientSocket;
public
constructor create(creatsuspended:Boolean);overload;
function initClientSocket:boolean;
protected
procedure execute();
end;
constructor TMyThread.create(createsuspended);
begin
...
end;
function TMYThread.initClientSocket:boolean;
begin
ClientSocket:=TClientSocket.create(ClientSocket);
ClientSocket.address:='127.0.0.1';
ClientSocket.prot:=1514;
ClientSocket.clientType:=ctNonBlocking;
ClientSocket.active:=true;
end;
procedure TMyThread.execute;
begin
initClientSocket;
while not terminated and CleintSocket.active do
begin // why clientsocket.active is false;
.......
end;
end;
privat
clientSocket:TClientSocket;
public
constructor create(creatsuspended:Boolean);overload;
function initClientSocket:boolean;
protected
procedure execute();
end;
constructor TMyThread.create(createsuspended);
begin
...
end;
function TMYThread.initClientSocket:boolean;
begin
ClientSocket:=TClientSocket.create(ClientSocket);
ClientSocket.address:='127.0.0.1';
ClientSocket.prot:=1514;
ClientSocket.clientType:=ctNonBlocking;
ClientSocket.active:=true;
end;
procedure TMyThread.execute;
begin
initClientSocket;
while not terminated and CleintSocket.active do
begin // why clientsocket.active is false;
.......
end;
end;
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货