LNet/ru

This is an old revision of LNet/ru, edited by Zoltanleo at . The current revision is 147920.

/* Documentation */

│ {{#if:{{PROTECTIONEXPIRY:edit|{{{Link|}}}}} |'''[[:{{{Link}}}|{{{Caption}}}]]''' │ }}

{{#if:{{PROTECTIONEXPIRY:edit|{{{Link|}}}}} |'''[[:{{{Link}}}|{{{Caption}}}]]''' │ }}

{{#if:{{PROTECTIONEXPIRY:edit|{{{Link|}}}}} |'''[[:{{{Link}}}|{{{Caption}}}]]''' │ }}

{{#if:{{PROTECTIONEXPIRY:edit|{{{Link|}}}}} |'''[[:{{{Link}}}|{{{Caption}}}]]''' │ }}

{{#if:{{PROTECTIONEXPIRY:edit|{{{Link|}}}}} |'''[[:{{{Link}}}|{{{Caption}}}]]''' │ }}

{{#if:{{PROTECTIONEXPIRY:edit|{{{Link|}}}}} |'''[[:{{{Link}}}|{{{Caption}}}]]''' │ }}

{{#if:{{PROTECTIONEXPIRY:edit|{{{Link|}}}}} |'''[[:{{{Link}}}|{{{Caption}}}]]''' │ }}

{{#if:{{PROTECTIONEXPIRY:edit|{{{Link|}}}}} |'''[[:{{{Link}}}|{{{Caption}}}]]''' │ }}

{{#if:{{PROTECTIONEXPIRY:edit|{{{Link|}}}}} |'''[[:{{{Link}}}|{{{Caption}}}]]''' │ }}

{{#if:{{PROTECTIONEXPIRY:edit|{{{Link|}}}}} |'''[[:{{{Link}}}|{{{Caption}}}]]''' │ }}

{{#if:{{PROTECTIONEXPIRY:edit|{{{Link|}}}}} |'''[[:{{{Link}}}|{{{Caption}}}]]''' │ }}

{{#if:{{PROTECTIONEXPIRY:edit|{{{Link|}}}}} |'''[[:{{{Link}}}|{{{Caption}}}]]''' │ }}

{{#if:{{PROTECTIONEXPIRY:edit|{{{Link|}}}}} |'''[[:{{{Link}}}|{{{Caption}}}]]''' │ }}

{{#if:{{PROTECTIONEXPIRY:edit|{{{Link|}}}}} |'''[[:{{{Link}}}|{{{Caption}}}]]''' │ }}

{{#if:{{PROTECTIONEXPIRY:edit|{{{Link|}}}}} |'''[[:{{{Link}}}|{{{Caption}}}]]''' │ }}

{{#if:{{PROTECTIONEXPIRY:edit|{{{Link|}}}}} |'''[[:{{{Link}}}|{{{Caption}}}]]''' │ }}

{{#if:{{PROTECTIONEXPIRY:edit|{{{Link|}}}}} |'''[[:{{{Link}}}|{{{Caption}}}]]''' │ }}

{{#if:{{PROTECTIONEXPIRY:edit|{{{Link|}}}}} |'''[[:{{{Link}}}|{{{Caption}}}]]''' │ }}

{{#if:{{PROTECTIONEXPIRY:edit|{{{Link|}}}}} |'''[[:{{{Link}}}|{{{Caption}}}]]''' │ }}

{{#if:{{PROTECTIONEXPIRY:edit|{{{Link|}}}}} |'''[[:{{{Link}}}|{{{Caption}}}]]''' │ }}

{{#if:{{PROTECTIONEXPIRY:edit|{{{Link|}}}}} |'''[[:{{{Link}}}|{{{Caption}}}]]''' │ }}

{{#if:{{PROTECTIONEXPIRY:edit|{{{Link|}}}}} |'''[[:{{{Link}}}|{{{Caption}}}]]''' │ }}

{{#if:{{PROTECTIONEXPIRY:edit|{{{Link|}}}}} |'''[[:{{{Link}}}|{{{Caption}}}]]''' │ }}

{{#if:{{PROTECTIONEXPIRY:edit|{{{Link|}}}}} |'''[[:{{{Link}}}|{{{Caption}}}]]''' │ }}

{{#if:{{PROTECTIONEXPIRY:edit|{{{Link|}}}}} |'''[[:{{{Link}}}|{{{Caption}}}]]''' │ }}

{{#if:{{PROTECTIONEXPIRY:edit|{{{Link|}}}}} |'''[[:{{{Link}}}|{{{Caption}}}]]''' │ }}

{{#if:{{PROTECTIONEXPIRY:edit|{{{Link|}}}}} |'''[[:{{{Link}}}|{{{Caption}}}]]''' │ }}

{{#if:{{PROTECTIONEXPIRY:edit|{{{Link|}}}}} |'''[[:{{{Link}}}|{{{Caption}}}]]''' │ }}

{{#if:{{PROTECTIONEXPIRY:edit|{{{Link|}}}}} |'''[[:{{{Link}}}|{{{Caption}}}]]''' │ }}

{{#if:{{PROTECTIONEXPIRY:edit|{{{Link|}}}}} |'''[[:{{{Link}}}|{{{Caption}}}]]''' │ }}

{{#if:{{PROTECTIONEXPIRY:edit|{{{Link|}}}}} |'''[[:{{{Link}}}|{{{Caption}}}]]''' │ }}

О компоненте

lNet или Lightweight Networking Library представляет собой набор классов и компонентов для включения управляемых событиями сетей TCP или UDP.

Авторы:

Лицензия: modified LGPL license (разрешает статическое связывание).

Загрузка

Существует два варианта библиотеки, которые больше полностью не синхронизируются:

Вы можете связаться с автором напрямую по электронной почте или перейти на канал #lnet на freenode.

Использование

Бросьте TLTCPComponent или TLUDPComponent на форму. Назначьте обработчики событий OnAccept, OnError, OnReceive, OnConnect и OnDisconnect. Обратите внимание, что это необязательно, но в большинстве случаев требуется для реализации функционала.

Клиентское соединение инициализируется вызовом Connect. Аргументами являются IP-адрес/имя хоста и порт соответственно. Используется неблокирующее соединение, это означает, что вы «НЕ» знаете, что вы подключены, пока случится событие OnConnect.

Соединение с сервером инициализируется вызовом Listen. Аргумент — порт.

адрес — это строковое представление IP-адреса, например: '127.0.0.1' или имя хоста, например 'localhost'.

Отправка данных другой стороне осуществляется с помощью метода Send/SendMessage.

События TLNetComponent

Документация

Документация по lNet частично завершена. Вы также можете использовать диаграммы классов Jesus и модулей в качестве основного справочника.

Документация по протоколам eventer и TCP/UDP.: http://members.chello.sk/ales/docs (Archived version at archive.org}

Обзорные схемы можно найти здесь.: http://members.chello.sk/ales/docs/diagrams/overview.html
Pictures:
New class diagram
All classes
lNet units
lNet units 2

Зеркало документов и текущие заметки: http://z505.com/cgi-bin/powtils/docs/1.6/idx.cgi?file=lnetlufdoc


Прим.переводчика: большинство ссылок старые, потому - битые. На гитхабе есть демки и документация


Installation

LNet 0.5+:

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:

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

* FTP and Telnet still need some additional features like authentication methods.

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:

* PING requires raw sockets which are only accessible to root on unix/linux platforms. It was decided that lNet won't support this, users who need PING should use the ping and ping6 programs via TProcess.

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