如果TClientSocket没有连接到Tserversocket就继续连接,但过一段时间就会出错,怎么回事?如果没有启动Tserversoket,Tclientsocket没能连接上Tserversocket,要再次连接的话应该怎么做?procedure TForm1.ClientSocket1Error(Sender: TObject;
  Socket: TCustomWinSocket; ErrorEvent: TErrorEvent;
  var ErrorCode: Integer);
begin
Errorcode := 0; {不弹出出错窗口}if not ClientSocket1.Active then
begin
ClientSocket1.Open; {建立连接}
end;end;
错误信息为:
Project Project2.exe raised exception class ESocketError with message 'Windows socket error:  (10055), on API 'connect''. Process stopped. Use Step or Run to continue.本人在CSDN上的信誉良好,问题解决一定给分,谢谢!

解决方案 »

  1.   

    连接不成功继续连接 , 试试 :procedure TForm1.Connect ;
    begin
      ClientSocket1.Open ;
    end ;FormCreate :
      Connect ;procedure TForm1.ClientSocket1Error(Sender: TObject;
      Socket: TCustomWinSocket; ErrorEvent: TErrorEvent;
      var ErrorCode: Integer) ;
    var
      StrErr: string;
    begin
      case ErrorEvent of
        eeConnect:    Connect ;
      end;
      ErrorCode := 0;
      if ClientSocket1.Active then
        ClientSocket1.Active := False;
    end;
      

  2.   

    TO:: wjlsmail(计算机质子) 
    第一:你对clietsocket有没有特别的设置?我只设置它的port和 address,其它是默认的设置
    第二:你运行了多少时间,你等十分钟试试有没有出错?如果你没有耐心等这么长的时间,
    也可以放一个timer控件,把它的间隔设为10,再将如下代码放入它的事件中
    if clientsocket1.active then   ClientSocket1.open;