QOTD: what changed
Revision 0 to 1. Removed lines have a minus sign; added lines have a plus sign.
Title: QOTD
| Old | New | Line | |
|---|---|---|---|
| 1 | + | ## Summary | |
| 2 | + | ||
| 3 | + | - Code example of using Synapse to query a public QOTD server. | |
| 4 | + | ||
| 5 | + | ## History | |
| 6 | + | ||
| 7 | + | [A wiki article about QOTD](http://en.wikipedia.org/wiki/QOTD) | |
| 8 | + | ||
| 9 | + | ## Accessing a QOTD server with Lazarus | |
| 10 | + | ||
| 11 | + | - You need to download and compile the [[Synapse|Synapse package]] | |
| 12 | + | - Put **tlntsend** in your Implementation/Uses clause | |
| 13 | + | - You will be using the QOTD port \#17 | |
| 14 | + | ||
| 15 | + | ``` pascal | |
| 16 | + | procedure DisplayQOTD; | |
| 17 | + | Var | |
| 18 | + | MyClient:TTelnetSend; | |
| 19 | + | szQuote:String; | |
| 20 | + | ||
| 21 | + | begin | |
| 22 | + | MyClient := TTelNetSend.Create; | |
| 23 | + | With MyClient do | |
| 24 | + | begin | |
| 25 | + | TargetPort := '17'; | |
| 26 | + | Timeout:=3000; | |
| 27 | + | TargetHost := 'alpha.mike-r.com'; | |
| 28 | + | end; | |
| 29 | + | If MyClient.Login then | |
| 30 | + | begin | |
| 31 | + | szQuote := MyClient.RecvString; | |
| 32 | + | If szQuote = '' then | |
| 33 | + | begin | |
| 34 | + | MyClient.Send(LineEnding + LineEnding); | |
| 35 | + | szQuote := MyClient.RecvString; | |
| 36 | + | end; | |
| 37 | + | end | |
| 38 | + | else szQuote:='Could not retrieve quote'; | |
| 39 | + | ||
| 40 | + | MyClient.Logout; | |
| 41 | + | ShowMessage(szQuote); | |
| 42 | + | FreeAndNil(MyClient.); | |
| 43 | + | end; | |
| 44 | + | ``` | |
| 45 | + | ||
| 46 | + | ## QOTD Servers | |
| 47 | + | ||
| 48 | + | Here are some public QOTD servers: | |
| 49 | + | ||
| 50 | + | - qotd.nngn.net | |
| 51 | + | - qotd.atheistwisdom.com | |
| 52 | + | - djxmmx.net | |
| 53 | + | - alpha.mike-r.com | |
| 54 | + | ||
| 55 | + | Windows users can install the 'Simple TCPIP services' and activate the Windows built-in QOTD server (localhost) | |
| 56 | + | ||
| 57 | + | --- | |
| 58 | + | *From the Free Pascal wiki, page "QOTD", as it stood on 2020-08-10 after a change by Trev, out of the wiki's dump of 2024-05-26. Copyright stays with the author who wrote it, according to the old wiki's [[Licensing]] page. If you have concerns about this material, [message the admin](/wiki-contact).* | |
| 59 | + | Category: Code Snippets | |
| 60 | + | Category: Lazarus |
