顶者有分!

解决方案 »

  1.   

    procedure TFrmUpdate.StartServerClick(Sender: TObject);
    begin
      with TCPServer do
      begin
        Active := False;
        DefaultPort := StrToInt(EdPort.Text);
        Active := True;
        LogMemo.Lines.Add(DateTimeToStr(Now)+' 服务已经启动!(Port: '+EdPort.Text+')');
      end;
    end;procedure TFrmUpdate.StopServerClick(Sender: TObject);
    begin
      with TCPServer do
      begin
        Active := False;
        LogMemo.Lines.Add(DateTimeToStr(Now)+' 服务已经停止!');
      end;
    end;
      

  2.   

    To hongqi162(失踪的月亮)谢了,请问你用的是TTcpServer?我没找到 DefaultPort 这个属性DefaultPort := StrToInt(EdPort.Text);
      

  3.   

    如果使用的是TTcpServer
    这段代码还是没用!Active := True;后,我使用自己编的测试,还是显示端口未打开
      

  4.   

    没用过Tcp控件,帮不上什么忙,帮你顶一下吧!
      

  5.   

    谢谢,顶啊!大家如果不是TTcpServersocket的也行啊!
      

  6.   

    详情请见
    http://expert.csdn.net/Expert/topic/2491/2491672.xml?temp=.8631098
      

  7.   

    At design time, set Active to True to make the socket open a connection when the application starts running (the default value is False). At runtime, use the Open or Close method to open or close the connection.
    用localport和open难道不行吗?
    也顶 :)
      

  8.   

    楼主检查一下代码吧,是不是被其它占用了这个端口;
    正常情况下,close以后,再open是没有错的,
    致少我还没错过