TcpClient.Sendln('FKMIS')ClientSocket.Receiveln我用的这个系统里为什么一定要发送"FKMIS",才能接收到,发送其它的为什么不行,是不是在什么地方定义过?如果是,在什么地方定义?

解决方案 »

  1.   

    给你一个用indy TCPClient的例子。(获取指定网页内容)
    c 是TIdTCPClient, Host设为HTTP Server主机,端口80
    procedure TForm1.Button1Click(Sender: TObject);
    var
      S: String;
      Len: Integer;
    begin
      c.Connect;
      c.writeln('GET / HTTP/1.1');
      c.writeln('Content-Type: text/html');
      c.writeln('Host: www.delphibbs.com');
      c.writeln('Accept: text/html,*/*');
      c.writeln('User-Agent: Mozilla/3.0 (compatible; Indy Library)');
      c.writeln('');
      Len := 0;
      repeat
        s := c.readln;
        if Copy(S, 1, 14) = 'Content-Length' then
          Len := StrToInt(Copy(S, 16, MAXINT));
      until s = '';
      S := c.ReadString(Len);
      memo1.lines.text := s;
    end;
      

  2.   

    to dickeybird888(于伟刚) 
    我问的是TcpClient.Sendln('FKMIS')的"FKMIS"在哪里定义过?TTcpServer对象收到这个信息后再返回指定的内容,由ClientSocket.Receiveln接收