title: TCP Client not receiving responses back from RTSP server
body: <p>In Delphi XE2, I'm using the <code>TTCPClient</code> component to communicate with an RTSP server. After trial and error not getting a response back from the server, I switched the project to send HTTP requests via port 80 (instead of 554 for RTSP) and tried to send a request to a website (www.google.com specifically). I'm still not getting any response.</p>
  
  <p>I have a <code>TTCPClient</code> component on the main form (<code>Form1</code>) called <code>Client</code>, a <code>TMemo</code> control called <code>Log</code>, a <code>TEdit</code> control called <code>txtHost</code>, and a <code>TBitBtn</code> control. Here's the relevant parts of the code:</p>
  
  <p><strong>Connecting to Server</strong></p>
  
  <pre><code>procedure TForm1.BitBtn1Click(Sender: TObject);
  begin
    if Client.Active then Client.Disconnect;
    Client.RemoteHost:= txtHost.Text;
    Client.RemotePort:= '80'; // '554';
    Client.Connect;
  end;
  </code></pre>
  
  <p><strong>OnConnect Event Handler (HTTP)</strong></p>
  
  <pre><code>procedure TForm1.ClientConnect(Sender: TObject);
  var
    S: String;
  begin
    Client.Sendln('GET / HTTP/1.0');
    Client.SendLn('');
  end;
  </code></pre>
  
  <p><strong>OnConnect Event Handler (RTSP)</strong></p>
  
  <pre><code>procedure TForm1.ClientConnect(Sender: TObject);
  var
    S: String;
  begin
    Client.SendLn('OPTIONS * RTSP/1.0');
    Client.SendLn('CSeq:0');
    Client.SendLn('');
  end;
  </code></pre>
  
  <p><strong>OnReceive Event Handler</strong></p>
  
  <pre><code>procedure TForm1.ClientReceive(Sender: TObject; Buf: PAnsiChar;
    var DataLen: Integer);
  var
    S, R: String;
  begin
    S:= Client.Receiveln;
    while S &lt;&gt; '' do begin
      R:= R+ S;
      S:= Client.Receiveln;
    end;
    Log.Lines.Append('&gt; RECEIVED ' + R);
  end;
  </code></pre>
  
  <p><strong>OnError Event Handler</strong></p>
  
  <pre><code>procedure TForm1.ClientError(Sender: TObject; SocketError: Integer);
  begin
    Log.Lines.Append('&gt; ERROR '+IntToStr(SocketError));
  end;
  </code></pre>
  
  <p>The <code>OnReceive</code> event is never called, nothing is coming back from any Server I'm connecting to.</p>
  
  <p>What am I doing wrong here?</p>
  
  <p><strong>References</strong></p>
  
  <p>These are some links which I'm referencing to:</p>
  
  <ul>
  <li><a href="http://effbot.org/zone/socket-intro.htm" rel="nofollow">http://effbot.org/zone/socket-intro.htm</a></li>
  <li><a href="http://www.ietf.org/rfc/rfc2326.txt" rel="nofollow">http://www.ietf.org/rfc/rfc2326.txt</a></li>
  <li><a href="http://folk.uio.no/meccano/reflector/smallclient.html" rel="nofollow">http://folk.uio.no/meccano/reflector/smallclient.html</a></li>
  <li><a href="http://www.samsungdforum.com/upload_files/files/guide/data/html/html_3/reference/rtsp_specification.html" rel="nofollow">http://www.samsungdforum.com/upload_files/files/guide/data/html/html_3/reference/rtsp_specification.html</a></li>
  </ul>
  
  <p>The camera I'm working with is <code>Grandstream GXV3601LL</code></p>
  
  <p><strong>UPDATE</strong></p>
  
  <p>I've concluded that the issue is with the RTSP server, and have asked a question on the forums on Grandstream's website. The code does work with other server connections.</p>