连接是出现socket error 10053错误,serversocket提示出现没有建立好socket 麻烦各位了谢谢了! 80
procedureTForm1.ServerSocket1ClientRead(Sender:TObject;Socket:TCustomWinSocket);varc:...
procedure TForm1.ServerSocket1ClientRead(Sender: TObject;
Socket: TCustomWinSocket);
var
c:integer;
a:tmemorystream;
b:tstringlist;
i:integer;
t:tlistitem;
s,s2,s3:string;
begin
a:=tmemorystream.Create;
b:=tstringlist.Create;
c:=socket.ReceiveLength;
serversocket1.Socket.Connections[0].ReceiveBuf(a,c);
b.LoadFromStream(a);
listbox1.Items.Assign(b); //保存进程信息到LISTBOX中
procedure TForm1.ClientSocket1Read(Sender: TObject;
Socket: TCustomWinSocket);
var
count:integer;
str:string;
a:array[0..99] of char;
b:string;
stream1:tmemorystream;
begin
// nmudp1.ReadBuffer(a,numberbytes); //获取控制端发送过来的控制指令
str:=trim(socket.ReceiveText);
if str='refresh' then //如果时刷新进程信息指令
begin
EnumerateProcess;
try
stream1:=tmemorystream.Create;
stream1.LoadFromFile('c:\result.txt'); //读取C盘下的进程信息
//nmudp1.SendStream(stream1); //发送进程信息给控制端
clientsocket1.Socket.SendStream(stream1);
finally
stream1.free;
// deletefile('c:\result.txt');
end;
end; 展开
Socket: TCustomWinSocket);
var
c:integer;
a:tmemorystream;
b:tstringlist;
i:integer;
t:tlistitem;
s,s2,s3:string;
begin
a:=tmemorystream.Create;
b:=tstringlist.Create;
c:=socket.ReceiveLength;
serversocket1.Socket.Connections[0].ReceiveBuf(a,c);
b.LoadFromStream(a);
listbox1.Items.Assign(b); //保存进程信息到LISTBOX中
procedure TForm1.ClientSocket1Read(Sender: TObject;
Socket: TCustomWinSocket);
var
count:integer;
str:string;
a:array[0..99] of char;
b:string;
stream1:tmemorystream;
begin
// nmudp1.ReadBuffer(a,numberbytes); //获取控制端发送过来的控制指令
str:=trim(socket.ReceiveText);
if str='refresh' then //如果时刷新进程信息指令
begin
EnumerateProcess;
try
stream1:=tmemorystream.Create;
stream1.LoadFromFile('c:\result.txt'); //读取C盘下的进程信息
//nmudp1.SendStream(stream1); //发送进程信息给控制端
clientsocket1.Socket.SendStream(stream1);
finally
stream1.free;
// deletefile('c:\result.txt');
end;
end; 展开
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询