关于用SERVERSOCKET和CLIENTSOCKET连接时出现查找失败的错误 ( 积分: 15 )

  • 主题发起人 主题发起人 delphisuccess
  • 开始时间 开始时间
D

delphisuccess

Unregistered / Unconfirmed
GUEST, unregistred user!
想请教大家对于这个问题的出现如何解决
谢谢
 
想请教大家对于这个问题的出现如何解决
谢谢
 
请问版主能帮忙解决下.
 
客戶端代碼:
procedure TForm2.ClientSocket1Connect(Sender: TObject;
Socket: TCustomWinSocket);
var
shost:string;
begin
sHost:=clientsocket1.Socket.LocalAddress;
clientsocket1.Socket.Sendtext(sHost);
end;

procedure TForm2.ClientSocket1Error(Sender: TObject;
Socket: TCustomWinSocket; ErrorEvent: TErrorEvent;
var ErrorCode: Integer);
begin
case errorevent of
eeconnect:showmessage('connect link fail');
eelookup:showmessage('find fail');
eeReceive:showmessage('receive fail');
eesend:showmessage('send fail');
end;
errorcode:=0;
end;

procedure TForm2.FormCreate(Sender: TObject);
begin
clientsocket1.Open;
end;
服務端代碼:
procedure TForm1.FormCreate(Sender: TObject);
begin
serversocket1.Open;
end;

procedure TForm1.ServerSocket1ClientError(Sender: TObject;
Socket: TCustomWinSocket; ErrorEvent: TErrorEvent;
var ErrorCode: Integer);
begin
case errorevent of
eeconnect:showmessage('connect link fail');
eelookup:showmessage('find fail');
eeReceive:showmessage('receive fail');
eesend:showmessage('send fail');
end;
errorcode:=0;
end;

procedure TForm1.ServerSocket1ClientRead(Sender: TObject;
Socket: TCustomWinSocket);
var
sip,str,sremoteaddress:string;
i:integer;
begin
i :=serversocket1.Socket.ActiveConnections;
str:= Trim(serversocket1.Socket.ReceiveText);
sremoteaddress := serversocket1.Socket.Connections[i - 1].RemoteAddress;
listbox1.Items.Add(sremoteaddress);
end;
請幫忙看看。萬分感謝。
 
procedure TForm1.ServerSocket1ClientRead(Sender: TObject;
Socket: TCustomWinSocket);
var
sip,str,sremoteaddress:string;
begin
str:= Trim(Socket.ReceiveText);
sremoteaddress := socket.RemoteAddress;
listbox1.Items.Add(sremoteaddress);
end;
 
迷糊兄:有些電腦不行。會出現連接失敗。
請問一般會是原因引起得。
還有我想通過服務端控制客戶端得運行。
 
我請教各位為什麼CLIENTDATASET在兩個窗口之間為不能引用。
我本身想通過另外一個窗口實現添加和修改部分。
但我改用全局變量將那個窗口CLIENTDATASET符值給全局變量有行。
我有些搞不明白是為什麼?
請各位兄弟解答!
謝謝。
 
接受答案了.
 
后退
顶部