Difference between revisions of "QOTD"

From Free Pascal wiki
Jump to navigationJump to search
m (Fixed syntax highlighting)
m (Fix heading levels)
 
Line 1: Line 1:
=Quote of the Day=
+
== Summary ==
 
 
==Summary==
 
  
 
* Code example of using Synapse to query a public QOTD server.
 
* Code example of using Synapse to query a public QOTD server.
  
==History==
+
== History ==
  
 
[http://en.wikipedia.org/wiki/QOTD A wiki article about QOTD]
 
[http://en.wikipedia.org/wiki/QOTD A wiki article about QOTD]
  
==Accessing a QOTD server with Lazarus==
+
== Accessing a QOTD server with Lazarus ==
  
 
* You need to download and compile the [[Synapse|Synapse package]]
 
* You need to download and compile the [[Synapse|Synapse package]]
Line 46: Line 44:
 
</syntaxhighlight>
 
</syntaxhighlight>
  
===QOTD Servers===
+
== QOTD Servers ==
  
 
Here are some public QOTD servers:
 
Here are some public QOTD servers:

Latest revision as of 04:10, 10 August 2020

Summary

  • Code example of using Synapse to query a public QOTD server.

History

A wiki article about QOTD

Accessing a QOTD server with Lazarus

  • You need to download and compile the Synapse package
  • Put tlntsend in your Implementation/Uses clause
  • You will be using the QOTD port #17
procedure DisplayQOTD;
Var 
MyClient:TTelnetSend;
szQuote:String;

begin
MyClient := TTelNetSend.Create;
With MyClient do
begin
  TargetPort := '17';
  Timeout:=3000;
  TargetHost := 'alpha.mike-r.com';
end;
If MyClient.Login then
  begin
       szQuote := MyClient.RecvString;
       If szQuote = '' then
       begin
          MyClient.Send(LineEnding + LineEnding);
          szQuote := MyClient.RecvString;
       end;
  end
  else szQuote:='Could not retrieve quote';

MyClient.Logout;
ShowMessage(szQuote);
FreeAndNil(MyClient.);
end;

QOTD Servers

Here are some public QOTD servers:

  • qotd.nngn.net
  • qotd.atheistwisdom.com
  • djxmmx.net
  • alpha.mike-r.com

Windows users can install the 'Simple TCPIP services' and activate the Windows built-in QOTD server (localhost)