<p>How do you use network sockets in Pascal?
­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­</p>

[{'answer_id': 17062, 'author': 'Mickey', 'author_id': 1494, 'author_profile': 'https://Stackoverflow.com/users/1494', 'pm_score': 4, 'selected': True, 'text': '<p>Here\'s an example taken from <a href="http://www.bastisoft.de/programmierung/pascal/pasinet.html" rel="nofollow noreferrer">http://www.bastisoft.de/programmierung/pascal/pasinet.html</a></p>\n\n<pre><code>program daytime;\n\n{ Simple client program }\n\nuses\n   sockets, inetaux, myerror;\n\nconst\n   RemotePort : Word = 13;\n\nvar\n   Sock : LongInt;\n   sAddr : TInetSockAddr;\n   sin, sout : Text;\n   Line : String;\n\nbegin\n   if ParamCount = 0 then GenError(\'Supply IP address as parameter.\');\n\n   with sAddr do\n   begin\n      Family := af_inet;\n      Port := htons(RemotePort);\n      Addr := StrToAddr(ParamStr(1));\n      if Addr = 0 then GenError(\'Not a valid IP address.\');\n   end;\n\n   Sock := Socket(af_inet, sock_stream, 0);\n   if Sock = -1 then SockError(\'Socket: \');\n\n   if not Connect(Sock, sAddr, sizeof(sAddr)) then SockError(\'Connect: \');\n   Sock2Text(Sock, sin, sout);\n   Reset(sin);\n   Rewrite(sout);\n\n   while not eof(sin) do   \n   begin\n      Readln(sin, Line);\n      Writeln(Line);\n   end;\n\n   Close(sin);\n   Close(sout);\n   Shutdown(Sock, 2);\nend.\n</code></pre>\n'}, {'answer_id': 22749, 'author': 'rix0rrr', 'author_id': 2474, 'author_profile': 'https://Stackoverflow.com/users/2474', 'pm_score': 0, 'selected': False, 'text': '<p>If you are using Delphi, I highly recommend <a href="http://www.indyproject.org/index.en.aspx" rel="nofollow noreferrer">Indy</a> sockets, a set of classes for easy manipulation of sockets and many other internet protocols (HTTP, FTP, NTP, POP3 etc.)</p>\n'}, {'answer_id': 38322, 'author': 'Karl-Otto Rosenqvist', 'author_id': 4101, 'author_profile': 'https://Stackoverflow.com/users/4101', 'pm_score': 0, 'selected': False, 'text': '<p>You cannot use OpenSSL with Indy version 10.5 that shippes with Delphi 2007. You have to download version 10,6 from <a href="http://www.indyproject.org/" rel="nofollow noreferrer">http://www.indyproject.org/</a> and install it into the IDE.</p>\n\n<p>Note that other packages might use Indy, like RemObjects, and therefore they have to be re-compiled too and this can be tricky due to cross-references.</p>\n'}, {'answer_id': 10459686, 'author': 'Pascal_Guy', 'author_id': 1376417, 'author_profile': 'https://Stackoverflow.com/users/1376417', 'pm_score': 1, 'selected': False, 'text': '<p>If you\'re using FPC or Lazarus(which is basically a rad IDE for FPC and a clone of delphi) you could use the <a href="http://synapse.ararat.cz/doku.php" rel="nofollow">Synapse</a> socket library. It\'s amazing.</p>\n'}]
['https://Stackoverflow.com/questions/17054', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/868/']