Difference between revisions of "Networking"

From Free Pascal wiki
Jump to navigationJump to search
(updated address for fpctwit)
(44 intermediate revisions by 20 users not shown)
Line 1: Line 1:
 
{{Networking}}
 
{{Networking}}
  
This page will be the start for tutorials with regard to network programming with Lazarus. I am not an expert on networking programming and I will add to the article as I learn about it. I invite others to help create networking articles. Just add a link to the next section, add a page and create your own WiKi article.
+
This page contains both tutorials/code and information with regard to network programming with Lazarus as well as plain FPC.
On this page some general information will be given.
 
  
 
__TOC__
 
__TOC__
== Other networking tutorials ==
 
  
* [[:fpc:Secure programming | Secure Programming]]
+
== TCP/IP Protocol ==
  
* [[Sockets]] - TCP/IP Sockets components
+
{{Note|Because there are multiple libraries (Synapse, lnet, fphttpclient, Indy,...) that provide networking functionality for FPC/Lazarus, many examples can be written for multiple libraries. Therefore you may see the same examples multiple times - for different libraries. Have a look at the [[Brook_for_Free_Pascal|Brook for Free Pascal]] or [https://bitbucket.org/mararosas/fpctwit/src/default/ fpctwit]  frameworks for examples on how to build frameworks that can use multiple network libraries}}
  
* [[lNet]] - Lightweight Networking Components
+
=== CGI/FastCGI - REST, CRUD, chat, blog, web page etc. ===
  
== TCP/IP Protocol ==
+
These functionalities can be used with [[fcl-web]]. They are also built into the Brook framework. Please have a look at [http://silvioprog.github.io/brookframework this page].
 +
https://github.com/silvioprog/brookframework
  
== XML ==
+
=== SSH/Telnet client, sending emails, downloading files, OAuthv1 examples ===
 +
See the [[Synapse]] page.
  
The Extensible Markup Language is a [http://www.w3.org/ W3C] recommended language created to interchange information between different systems. It is a text based way to store information. Modern data interchange languages such as XHTML, as well as most WebServices technologies, are based on XML.
+
=== Webserver example ===
  
Currently there is a set of units that provides support for XML on Lazarus. These units are called "XMLRead", "XMLWrite" and "DOM" and they are part of the Free Component Library (FCL) from the Free Pascal Compiler. The FCL is already on the default search path for the compiler on Lazarus, so you only need to add the units to your uses clause in order to get XML support. The FCL is not documented currently (October / 2005), so this short tutorial aims at introducing XML access using those units.
+
Given below is an example http server written with [[Synapse]] and tested in Win XP and macOS, after changing the Synapse source to use a fixed constant $20000 as MSG_NOSIGNAL, because this constant isn't present in the sockets unit in macOS. ''Note: please send your bug reports to the Synapse project - they are quite responsive - so everybody profits from improvements. To do: check if this modification is still needed for current (Oct 2012) Synapse''
  
The XML DOM (Document Object Model) is a set of standarized objects that provide a similar interface for the use of XML on different languages and systems. The standard only specifies the methods, properties and other interface parts of the object, leaving the implementation free for different languages. The FCL currently supports fully the [http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/|XML DOM 1.0].
+
<syntaxhighlight lang="pascal">
 +
{
 +
  The Micro Pascal WebServer
  
=== Basic Example ===
+
  This is a very simple example webserver implemented with the Synapse library.
  
For Delphi Programmers:
+
  It works with blocking sockets and a single thread, so it
Note that when working with TXMLDocument, the text within a Node is considered a separate TEXT Node.  As a result, you must access a node's text value as a separate node. For instance, consider the following XML:
+
  can only handle one request at a given time.
  
<code>
+
  It will write the headers that it receives from the browser
<?xml version="1.0" encoding="utf-8"?>
+
  to the standard output.
<request>
 
  <request_type>PUT_FILE</request_type>
 
  <username>123</username>
 
  <password>abc</password>
 
</request>
 
</code>
 
  
Consider also the following code example:
+
  It serves a fixed webpage for the / URI
 +
  For any other URI it will return 404 not found
 +
}
  
<code>
+
program upserver;
var
 
  PassNode: TDOMNode;
 
  Doc:      TXMLDocument;
 
begin
 
  Doc := TXMLDocument.Create;
 
  // Read in xml file from disk
 
  ReadXMLFile(Doc, 'c:\xmlfiles\test.xml');
 
  // Retrieve the "password" node
 
  PassNode := Doc.DocumentElement.FindNode('password');
 
  // Write out value of the selected node
 
  WriteLn(PassNode.NodeValue); // will be blank
 
  // The text of the node is actually a separate child node
 
  WriteLn(PassNode.FirstChild.NodeValue); // correctly prints "abc"
 
</code>
 
  
 +
{$ifdef fpc}
 +
  {$mode delphi}
 +
{$endif}
  
Let´s say you want to access a XML file called 'C:\Programas\teste.xml'. Here is the file content:
+
{$apptype console}
  
<code>
+
uses
<?xml version="1.0" encoding="ISO-8859-1"?>
+
   Classes, blcksock, sockets, Synautil, SysUtils;
<images directory="mydir">
 
  <imageNode URL="graphic.jpg" title="">
 
    <Peca DestinoX="0" DestinoY="0">Pecacastelo.jpg1.swf</Peca>
 
    <Peca DestinoX="0" DestinoY="86">Pecacastelo.jpg2.swf</Peca>
 
   </imageNode>
 
</images>
 
</code>
 
  
The following code can write the Node´s names to a TMemo placed on a form:
+
{@@
 +
  Attends a connection. Reads the headers and gives an
 +
  appropriate response
 +
}
  
<code>
+
procedure AttendConnection(ASocket: TTCPBlockSocket);
var
+
var
   Documento: TXMLDocument;
+
   timeout: integer;
   i, j: Integer;
+
   s: string;
begin
+
   method, uri, protocol: string;
   Documento := TXMLDocument.Create;
+
   OutputDataString: string;
   ReadXMLFile(Documento, 'C:\Programas\teste.xml');
+
   ResultCode: integer;
   Memo.Lines.Clear;
+
begin
  with Documento.DocumentElement.ChildNodes do
+
   timeout := 120000;
   begin
 
    for i := 0 to (Count - 1) do
 
    begin
 
      Memo.Lines.Add(Item[i].NodeName + ' ' + Item[i].NodeValue);
 
      for j := 0 to (Item[i].ChildNodes.Count - 1) do
 
      begin
 
        Memo.Lines.Add(Item[i].ChildNodes.Item[j].NodeName + ' '
 
        + Item[i].ChildNodes.Item[j].NodeValue);
 
      end;
 
    end;
 
  end;
 
  Documento.Free;
 
end;
 
</code>
 
  
=== Populating a TreeView with XML ===
+
  WriteLn('Received headers+document from browser:');
  
One common use of XML files is to parse them and show their contents in a tree like format. You can find the TTreeView component on the "Common Controls" tab on Lazarus.
+
  //read request line
 +
  s := ASocket.RecvString(timeout);
 +
  WriteLn(s);
 +
  method := fetch(s, ' ');
 +
  uri := fetch(s, ' ');
 +
  protocol := fetch(s, ' ');
  
The function below will take a XML document previously loaded from a file or generated on code, and will populate a TreeView with it´s contents. The caption of each node will be the content of the first attribute of each node.
+
  //read request headers
 +
  repeat
 +
    s := ASocket.RecvString(Timeout);
 +
    WriteLn(s);
 +
  until s = '';
  
<pre>
+
   // Now write the document to the output stream
procedure TForm1.XML2Tree(tree: TTreeView; XMLDoc: TXMLDocument);
 
var
 
   iNode: TDOMNode;
 
  
   procedure ProcessNode(Node: TDOMNode; TreeNode: TTreeNode);
+
   if uri = '/' then
  var
 
    cNode: TDOMNode;
 
 
   begin
 
   begin
    if Node = nil then Exit; // Stops if reached a leaf
 
   
 
    // Adds a node to the tree
 
    TreeNode := tree.Items.AddChild(TreeNode, Node.Attributes[0].NodeValue);
 
  
     // Goes to the child node
+
     // Write the output document to the stream
     cNode := Node.ChildNodes.Item[0];
+
     OutputDataString :=
 +
      '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"'
 +
      + ' "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">' + CRLF
 +
      + '<html><h1>Teste</h1></html>' + CRLF;
  
     // Processes all child nodes
+
     // Write the headers back to the client
     while cNode <> nil do
+
     ASocket.SendString('HTTP/1.0 200' + CRLF);
     begin
+
     ASocket.SendString('Content-type: Text/Html' + CRLF);
      ProcessNoDe(cNode, TreeNode);
+
    ASocket.SendString('Content-length: ' + IntTostr(Length(OutputDataString)) + CRLF);
      cNode := cNode.NextSibling;
+
     ASocket.SendString('Connection: close' + CRLF);
     end;
+
     ASocket.SendString('Date: ' + Rfc822DateTime(now) + CRLF);
  end;
+
     ASocket.SendString('Server: Servidor do Felipe usando Synapse' + CRLF);
      
+
     ASocket.SendString('' + CRLF);
begin
 
  iNode := XMLDoc.DocumentElement.ChildNodes.Item[0];
 
  while iNode <> nil do
 
  begin
 
     ProcessNode(iNode, nil); // Recursive
 
     iNode := iNode.NextSibling;
 
  end;
 
end;
 
</pre>
 
  
=== Modifying a XML document ===
+
  //  if ASocket.lasterror <> 0 then HandleError;
  
The first thing to remember is that TDOMDocument is the "handle" to the DOM. You can get an instance of this class by creating one or by loading a XML document.
+
    // Write the document back to the browser
 +
    ASocket.SendString(OutputDataString);
 +
  end
 +
  else
 +
    ASocket.SendString('HTTP/1.0 404' + CRLF);
 +
end;
  
Nodes on the other hand cannot be created like a normal object. You *must* use the methods provided by TDOMDocument to create them, and latter use other methods to put them on the correct place on the tree. This is because nodes must be "owned" by a specific document on DOM.
+
var
 +
  ListenerSocket, ConnectionSocket: TTCPBlockSocket;
  
Below are some common methods from TDOMDocument:
+
begin
 +
  ListenerSocket := TTCPBlockSocket.Create;
 +
  ConnectionSocket := TTCPBlockSocket.Create;
  
<pre>
+
  ListenerSocket.CreateSocket;
  function CreateElement(const tagName: DOMString): TDOMElement; virtual;
+
  ListenerSocket.setLinger(true,10);
  function CreateTextNode(const data: DOMString): TDOMText;
+
  ListenerSocket.bind('0.0.0.0','1500');
  function CreateCDATASection(const data: DOMString): TDOMCDATASection;
+
  ListenerSocket.listen;
    virtual;
 
  function CreateAttribute(const name: DOMString): TDOMAttr; virtual;
 
</pre>
 
  
And here an example method that will located the selected item on a TTreeView and then insert a child node to the XML document it represents. The TreeView must be previously filled with the contents of a XML file using the [[Networking#Populating a TreeView with XML|XML2Tree function]].
+
  repeat
 +
    if ListenerSocket.canread(1000) then
 +
    begin
 +
      ConnectionSocket.Socket := ListenerSocket.accept;
 +
      WriteLn('Attending Connection. Error code (0=Success): ', ConnectionSocket.lasterror);
 +
      AttendConnection(ConnectionSocket);
 +
      ConnectionSocket.CloseSocket;
 +
    end;
 +
  until false;
  
<pre>
+
  ListenerSocket.Free;
procedure TForm1.actAddChildNode(Sender: TObject);
+
   ConnectionSocket.Free;
var
+
end.
   Posicao: Integer;
+
</syntaxhighlight>
  NovoNo: TDomNode;
 
begin
 
  {*******************************************************************
 
  *  Detects the selected element
 
  *******************************************************************}
 
  if TreeView1.Selected = nil then Exit;
 
  
  if TreeView1.Selected.Level = 0 then
+
=== TCP/IP Client - Server Example using built-in FCL-Net components ===
  begin
 
    Posicao := TreeView1.Selected.Index;
 
  
    NovoNo := XMLDoc.CreateElement('item');
+
Please have a look at [http://pascalgeek.blogspot.com/2012/06/encryption-decryption-and-asynchronous.html this blog post].
    TDOMElement(NovoNo).SetAttribute('nome', 'Item');
 
    TDOMElement(NovoNo).SetAttribute('arquivo', 'Arquivo');
 
    XMLDoc.DocumentElement.ChildNodes.Item[Posicao].AppendChild(NovoNo);
 
  
    {*******************************************************************
+
=== Download HTTP page body, web server upload using POST, get external IP address ===
    *  Updates the TreeView
 
    *******************************************************************}
 
    TreeView1.Items.Clear;
 
    XML2Tree(TreeView1, XMLDoc);
 
  end
 
  else if TreeView1.Selected.Level >= 1 then
 
  begin
 
    {*******************************************************************
 
    *  This function only works on the first level of the tree,
 
    *  but can easely modifyed to work for any number of levels
 
    *******************************************************************}
 
  end;
 
end;
 
</pre>
 
  
 +
These examples (using the FPC/Lazarus built in fphttpclient) can be found at [[fphttpclient#Examples]]
  
=== Create a TXMLDocument from a string ===
+
=== LazWebsockets ===
  
Given al XML file in MyXmlString, the following code will create it's DOM:
+
A WebSocket is a persistent connection between a client and server. WebSockets provide a bidirectional, full-duplex communications channel that operates over HTTP through a single TCP/IP socket connection. At its core, the WebSocket protocol facilitates message passing between a client and server. [https://github.com/Warfley/LazWebsockets LazWebsockets] provides a small Websocket server and client implementation written for the FPC and Lazarus. It is based on the FCL ssockets unit and therefore independent of any additional dependencies. It can be easily built using only the FPC without Lazarus. There is a chat server and chat client example demo.
  
<pre>
+
== Web Services ==
Var
 
  S : TStringStream;
 
  XML : TXMLDocument;
 
  
begin
+
According to the [http://www.w3.org/ W3C] a Web service is a software system designed to support interoperable machine-to-machine interaction over a network. It has an interface that is described in a machine-processable format such as WSDL. Other systems interact with the Web service in a manner prescribed by its interface using messages, which may be enclosed in a SOAP envelope, or follow a REST approach. These messages are typically conveyed using HTTP, and are normally comprised of XML in conjunction with other Web-related standards. Software applications written in various programming languages and running on various platforms can use web services to exchange data over computer networks like the Internet in a manner similar to inter-process communication on a single computer. This interoperability (e.g., between Windows and Linux applications) is due to the use of open standards. OASIS and the W3C are the primary committees responsible for the architecture and standardization of web services. To improve interoperability between web service implementations, the WS-I organisation has been developing a series of profiles to further define the standards involved.
  S:= TStringStream.Create(MyXMLString);
 
  Try
 
    S.Position:=0;
 
    XML:=Nil;
 
    ReadXMLFile(XML,S); // Complete XML document
 
    // Alternatively:
 
    ReadXMLFragment(AParentNode,S); // Read only XML fragment.
 
  Finally
 
    S.Free;
 
  end;
 
end;
 
</pre>
 
  
== WebServices ==
+
=== RSS example ===
  
According to the [http://www.w3.org/ W3C] a Web service is a software system designed to support interoperable machine-to-machine interaction over a network. It has an interface that is described in a machine-processable format such as WSDL. Other systems interact with the Web service in a manner prescribed by its interface using messages, which may be enclosed in a SOAP envelope, or follow a REST approach. These messages are typically conveyed using HTTP, and are normally comprised of XML in conjunction with other Web-related standards. Software applications written in various programming languages and running on various platforms can use web services to exchange data over computer networks like the Internet in a manner similar to inter-process communication on a single computer. This interoperability (e.g., between Windows and Linux applications) is due to the use of open standards. OASIS and the W3C are the primary committees responsible for the architecture and standardization of web services. To improve interoperability between web service implementations, the WS-I organisation has been developing a series of profiles to further define the standards involved.
+
For an RSS example, see this article [[RSS|RSS Unit]].
  
 
=== Web Service Toolkit for FPC & Lazarus ===
 
=== Web Service Toolkit for FPC & Lazarus ===
 
[[Web Service Toolkit]] is a web services package for FPC and Lazarus.
 
[[Web Service Toolkit]] is a web services package for FPC and Lazarus.
  
== External Links ==
+
=== Using Google Translate ===
  
'''XML'''
+
For an example of using the Google translation service, see the article [[Using Google Translate]] which employs the [[fphttpclient]] component from the [[fcl-web]] package.
  
* [http://www.w3schools.com/xml/default.asp W3Schools] Xml Tutorial
+
== See also ==
 
+
* [[Portal:Web Development|Web Development Portal]]
* [http://www.thomas-zastrow.de/texte/fpcxml/index.php Thomas Zastrow article] FPC and XML
+
* [[Networking libraries]] - comparison of various networking libraries
 +
* [[Brook Framework]] - The perfect Free Pascal framework for your web applications. It's pure Pascal. You don't need to leave your preferred programming language.
 +
* [http://www.fastplaz.com FastPlaz] - Fast Web Framework for pascal. More features like theme/templating, simple Model, session, mailer, etc.
 +
* [[Sockets]] - TCP/IP Sockets components
 +
* [[fcl-net]] - Networking library supplied with FPC
 +
* [[Indy_with_Lazarus]] - Networking Components; How to install
 +
* [[lNet]] - Lightweight Networking Components
 +
* [[Synapse]] - Serial port and synchronous TCP/IP Library
 +
* [[XML Tutorial]] - XML is often utilized on network communications
 +
* [[FPC and Apache Modules]]
 +
* [[fcl-web]] - Also known as fpWeb, this is a library to develop web applications which can be deployed as cgi, fastcgi or apache modules.
 +
* [[Secure programming | Secure Programming]]
 +
* [[Internet Tools]] - A wrapper around Synapse/wininet/Android's httpcomponents simplifying https and redirections, and a XPath/XQuery/CSS Selector/JSONiq engine to process the downloaded pages
 +
* [https://fanoframework.github.io Fano Framework] - Web application framework written in Free Pascal.

Revision as of 10:01, 2 May 2020

Deutsch (de) English (en) español (es) français (fr) 日本語 (ja) 한국어 (ko) polski (pl) português (pt) русский (ru) slovenčina (sk) 中文(中国大陆)‎ (zh_CN)

This page contains both tutorials/code and information with regard to network programming with Lazarus as well as plain FPC.

TCP/IP Protocol

Light bulb  Note: Because there are multiple libraries (Synapse, lnet, fphttpclient, Indy,...) that provide networking functionality for FPC/Lazarus, many examples can be written for multiple libraries. Therefore you may see the same examples multiple times - for different libraries. Have a look at the Brook for Free Pascal or fpctwit frameworks for examples on how to build frameworks that can use multiple network libraries

CGI/FastCGI - REST, CRUD, chat, blog, web page etc.

These functionalities can be used with fcl-web. They are also built into the Brook framework. Please have a look at this page. https://github.com/silvioprog/brookframework

SSH/Telnet client, sending emails, downloading files, OAuthv1 examples

See the Synapse page.

Webserver example

Given below is an example http server written with Synapse and tested in Win XP and macOS, after changing the Synapse source to use a fixed constant $20000 as MSG_NOSIGNAL, because this constant isn't present in the sockets unit in macOS. Note: please send your bug reports to the Synapse project - they are quite responsive - so everybody profits from improvements. To do: check if this modification is still needed for current (Oct 2012) Synapse

{
  The Micro Pascal WebServer

  This is a very simple example webserver implemented with the Synapse library.

  It works with blocking sockets and a single thread, so it
  can only handle one request at a given time.

  It will write the headers that it receives from the browser
  to the standard output.

  It serves a fixed webpage for the / URI
  For any other URI it will return 404 not found
}

program upserver;

{$ifdef fpc}
  {$mode delphi}
{$endif}

{$apptype console}

uses
  Classes, blcksock, sockets, Synautil, SysUtils;

{@@
  Attends a connection. Reads the headers and gives an
  appropriate response
}

procedure AttendConnection(ASocket: TTCPBlockSocket);
var
  timeout: integer;
  s: string;
  method, uri, protocol: string;
  OutputDataString: string;
  ResultCode: integer;
begin
  timeout := 120000;

  WriteLn('Received headers+document from browser:');

  //read request line
  s := ASocket.RecvString(timeout);
  WriteLn(s);
  method := fetch(s, ' ');
  uri := fetch(s, ' ');
  protocol := fetch(s, ' ');

  //read request headers
  repeat
    s := ASocket.RecvString(Timeout);
    WriteLn(s);
  until s = '';

  // Now write the document to the output stream

  if uri = '/' then
  begin

    // Write the output document to the stream
    OutputDataString :=
      '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"'
      + ' "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">' + CRLF
      + '<html><h1>Teste</h1></html>' + CRLF;

    // Write the headers back to the client
    ASocket.SendString('HTTP/1.0 200' + CRLF);
    ASocket.SendString('Content-type: Text/Html' + CRLF);
    ASocket.SendString('Content-length: ' + IntTostr(Length(OutputDataString)) + CRLF);
    ASocket.SendString('Connection: close' + CRLF);
    ASocket.SendString('Date: ' + Rfc822DateTime(now) + CRLF);
    ASocket.SendString('Server: Servidor do Felipe usando Synapse' + CRLF);
    ASocket.SendString('' + CRLF);

  //  if ASocket.lasterror <> 0 then HandleError;

    // Write the document back to the browser
    ASocket.SendString(OutputDataString);
  end
  else
    ASocket.SendString('HTTP/1.0 404' + CRLF);
end;

var
  ListenerSocket, ConnectionSocket: TTCPBlockSocket;

begin
  ListenerSocket := TTCPBlockSocket.Create;
  ConnectionSocket := TTCPBlockSocket.Create;

  ListenerSocket.CreateSocket;
  ListenerSocket.setLinger(true,10);
  ListenerSocket.bind('0.0.0.0','1500');
  ListenerSocket.listen;

  repeat
    if ListenerSocket.canread(1000) then
    begin
      ConnectionSocket.Socket := ListenerSocket.accept;
      WriteLn('Attending Connection. Error code (0=Success): ', ConnectionSocket.lasterror);
      AttendConnection(ConnectionSocket);
      ConnectionSocket.CloseSocket;
    end;
  until false;

  ListenerSocket.Free;
  ConnectionSocket.Free;
end.

TCP/IP Client - Server Example using built-in FCL-Net components

Please have a look at this blog post.

Download HTTP page body, web server upload using POST, get external IP address

These examples (using the FPC/Lazarus built in fphttpclient) can be found at fphttpclient#Examples

LazWebsockets

A WebSocket is a persistent connection between a client and server. WebSockets provide a bidirectional, full-duplex communications channel that operates over HTTP through a single TCP/IP socket connection. At its core, the WebSocket protocol facilitates message passing between a client and server. LazWebsockets provides a small Websocket server and client implementation written for the FPC and Lazarus. It is based on the FCL ssockets unit and therefore independent of any additional dependencies. It can be easily built using only the FPC without Lazarus. There is a chat server and chat client example demo.

Web Services

According to the W3C a Web service is a software system designed to support interoperable machine-to-machine interaction over a network. It has an interface that is described in a machine-processable format such as WSDL. Other systems interact with the Web service in a manner prescribed by its interface using messages, which may be enclosed in a SOAP envelope, or follow a REST approach. These messages are typically conveyed using HTTP, and are normally comprised of XML in conjunction with other Web-related standards. Software applications written in various programming languages and running on various platforms can use web services to exchange data over computer networks like the Internet in a manner similar to inter-process communication on a single computer. This interoperability (e.g., between Windows and Linux applications) is due to the use of open standards. OASIS and the W3C are the primary committees responsible for the architecture and standardization of web services. To improve interoperability between web service implementations, the WS-I organisation has been developing a series of profiles to further define the standards involved.

RSS example

For an RSS example, see this article RSS Unit.

Web Service Toolkit for FPC & Lazarus

Web Service Toolkit is a web services package for FPC and Lazarus.

Using Google Translate

For an example of using the Google translation service, see the article Using Google Translate which employs the fphttpclient component from the fcl-web package.

See also

  • Web Development Portal
  • Networking libraries - comparison of various networking libraries
  • Brook Framework - The perfect Free Pascal framework for your web applications. It's pure Pascal. You don't need to leave your preferred programming language.
  • FastPlaz - Fast Web Framework for pascal. More features like theme/templating, simple Model, session, mailer, etc.
  • Sockets - TCP/IP Sockets components
  • fcl-net - Networking library supplied with FPC
  • Indy_with_Lazarus - Networking Components; How to install
  • lNet - Lightweight Networking Components
  • Synapse - Serial port and synchronous TCP/IP Library
  • XML Tutorial - XML is often utilized on network communications
  • FPC and Apache Modules
  • fcl-web - Also known as fpWeb, this is a library to develop web applications which can be deployed as cgi, fastcgi or apache modules.
  • Secure Programming
  • Internet Tools - A wrapper around Synapse/wininet/Android's httpcomponents simplifying https and redirections, and a XPath/XQuery/CSS Selector/JSONiq engine to process the downloaded pages
  • Fano Framework - Web application framework written in Free Pascal.