HackerPro536

TCP Request

Dec 9th, 2015
127
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Pascal 0.69 KB | None | 0 0
  1. program TestApp;
  2.  
  3. uses
  4.     blcksock;
  5.      
  6. var
  7.     sock: TTCPBlockSocket;
  8.      
  9. procedure Main();
  10. var
  11.     buffer: String = '';
  12. begin
  13.     sock := TTCPBlockSocket.Create;
  14.      
  15.     sock.Connect('66.79.183.71', '80');
  16.     // Was there an error?
  17.     if sock.LastError <> 0 then
  18.     begin
  19.         writeLn('Could not connect to server.');
  20.         halt(1);
  21.     end;
  22.     // Send a HTTP request
  23.     sock.SendString('GET /blog/ HTTP/1.1'#13#10'Host: www.daniel15.com'#13#10#13#10);
  24.      
  25.     // Keep looping...
  26.     repeat
  27.         buffer := sock.RecvPacket(2000);
  28.         write(buffer);
  29.     // ...until there's no more data.
  30.     until buffer = '';
  31. end;
  32.  
  33.  
  34. begin
  35.     Main();
  36. end.
Advertisement
Add Comment
Please, Sign In to add comment