Sign in Join
Wiki copytemporary

lNet

English · Русский

About

lNet or Lightweight Networking Library is a collection of classes and components to enable event-driven TCP or UDP networking.

Authors:

License: modified LGPL license (permits static linking).

Download

There are two variants of the library, which are no longer completely synchronised:

You can contact the author directly by email or go to #lnet channel on freenode.

Usage

Drop a TLTCPComponent or TLUDPComponent on a form. Assign OnAccept, OnError, OnReceive, OnConnect and OnDisconnect event handlers. Note that this is optional but in most cases required for functionality.

Client connection is initialized with the Connect call. Arguments are IP address/hostname and port respectivly. Non-blocking connect is used, this means that you DON'T know that you're connected until OnConnect event is fired.

Server connection is initialized with the Listen* call. Argument is port.

Note: address is a string representation of IP eg: '127.0.0.1' or a hostname like 'localhost'.

Sending data to the other side is accomplished with the Send/SendMessage method.

Events of TLNetComponent

Documentation

Documentation of lNet is partially done. You can also use Jesus' diagrams of classes and units as basic reference.

Documentation of eventer and TCP/UDP protocols: http://members.chello.sk/ales/docs (Archived version at archive.org}
Overview diagrams can be found here: http://members.chello.sk/ales/docs/diagrams/overview.html
Pictures:
New class diagram
All classes
lNet units
lNet units 2
Docs Mirror and Ongoing Notes: http://z505.com/cgi-bin/powtils/docs/1.6/idx.cgi?file=lnetlufdoc

Installation

LNet 0.5+:

Note: users who don't want to depend on LCL but use LNet in Lazarus (non-visually), can just compile lnetbase.lpk, which adds all the base units to path.

LNet 0.4:

Note: older lNet is extraced to "lnetpackage" dir. Since 0.4.0 the "visual" and "non visual" packages are in one distribution file.

Package contents

The package consists of base lNet units library, lTelnet for telnet protocol, lFTP for ftp protocol and lNetComponents libraries for providing visual and non-visual components for networking. As of 0.4.0 lHTTP and lSMTP components have been added. Since 0.5.1 there's a MIME support as part of the library mainly for creation of multipart messages for SMTP. Since 0.6.0 lNet supports SSL in a modular way, and SMTP protocol has been extended to full support of SSL/TLS (including runtime STARTTLS negotiation). HTTPS client side is supported too.

Testing

The non-visual console components were tested on Win32, Win64, Linux_x86_32, Linux_x86_64, Linux_PPC, Linux_PPC_64, Linux_ARM* (2.1.4+) and FreeBSD_x86_32. The visual (Lazarus packages) components were tested in Win32, Win64, ARM/WinCE, Linux_x86_32, Linux_x86_64 and FreeBSD_x86_32. (gtk1 and gtk2 on unix platforms)

History

Stability

On Linux, since you start using LNet, GDB can crash randomly (upon compilations) with diverse kind of reports. Setting debugger to Automatic in both lnetbase and lnetvisual package's options fixes the issue.

Roadmap

Items that are struck through have been completed in the indicated version:

Requirements

LNet 0.6+:

LNet 0.5:

LNet 0.4:

Ubuntu special notice

Some "missing files" are, in fact, in the "/net" subfolder and are not found by the fpc compiler. Simply copy missing files from the subfolder (lnet.pas, tomwinsock.pas, lfunc.inc...) "/usr/lib/lazarus/components/lnetpackage/lnet" in the "/usr/lib/lazarus/components/lnetpackage" folder (adjust paths as necessary). Then complete the setup by following the installation procedure. (by Steph12358)

API changes

0.1 to 0.2

0.2 to 0.3

0.3 to 0.4

0.4 to 0.5

0.5.4- to 0.5.5+

0.5 to 0.6

Note for 0.4.0: In version 0.4.0, I forgot to move lHTTPSettings unit from lib to the http example. It was NOT supposed to be a part of the library, just the example. DON'T use this, it's not a "library", it's a part of the example (http server will get it's own project later)

lNet for FreeBSD, Linux, macOS and Windows

See also


From the Free Pascal wiki, page "lNet", as it stood on 2023-09-05 after a change by Zoltanleo, 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.

Revision 2, last changed by WikiArchive .

Talk about this page

Nobody has opened a bench for this page yet. Sign in to open one.