Página 1 de 1

Harbour com DBF via TCP / IP

Enviado: 31 Ago 2009 21:13
por sygecom
Revision: 12382
http://harbour-project.svn.sourceforge. ... 2&view=rev
Author: druzus
Date: 2009-08-31 22:56:45 +0000 (Mon, 31 Aug 2009)

Log Message:
-----------
2009-09-01 00:56 UTC+0200 Przemyslaw Czerpak (druzus/at/priv.onet.pl)
* harbour/harbour.spec
* harbour/harbour-win-spec
* harbour/harbour-wce-spec
* harbour/bin/hb-func.sh
* harbour/contrib/Makefile
+ harbour/contrib/hbnetio
+ harbour/contrib/hbnetio/netio.h
+ harbour/contrib/hbnetio/netiomt.prg
+ harbour/contrib/hbnetio/netiocli.c
+ harbour/contrib/hbnetio/netiosrv.c
+ harbour/contrib/hbnetio/Makefile
+ added new library: HBNETIO.
It implements alternative RDD IO API which uses own TCP/IP sockets
to exchange data between client and server.
This library contains client and server code and is fully MT safe.
On client side it's enough to execute:
NETIO_CONNECT( [<cServer>], [<cPort>], [<nTimeOut>] ) -> <lOK>
function to register alternative NETIO RDD API and set default
server address and port.
<cServer> - server addres (default 127.0.0.1)
<cPort> - server port (default 2941)
<nTimeOut> - connection timeout (default -1 - not timeout)
Above settings are thread local and parameters of the 1-st successful
connection are used as default values for each new thread.
After registering NETIO client by above function each file starting
"net:" prefix is automatically redirected to given NETIO server, i.e.
use "net:mytable"
It's also possible to pass NETIO server and port as part of file name,
i.e.:
use "net:192.168.0.1:10005:mytable"
On the server side the following functions are available:
create NETIO listen socket:
NETIO_LISTEN( [<nPort>], [<cAddress>], [<cRootDir>] )
-> <pListenSocket> | NIL
accept new connection on NETIO listen socket:
NETIO_ACCEPT( <pListenSocket> [, <nTimeOut>] )
-> <pConnectionSocket> | NIL
start connection server:
NETIO_SERVER( <pConnectionSocket> ) -> NIL
stop connection accepting or connection server:
NETIO_SERVERSTOP( <pListenSocket> | <pConnectionSocket>, <lStop> )
-> NIL
activate MT NETIO server (it needs MT HVM):
NETIO_MTSERVER( [<nPort>], [<cAddress>] ) -> <pListenSocket> | NIL

To create NETIO server is enough to compile and link with MT HVM
this code:

proc main()
local pListenSocket

pListenSocket := netio_mtserver()
if empty( pListenSocket )
? "Cannot start server."
else
wait "Press any key to stop NETIO server."
netio_serverstop( pListenSocket )
pListenSocket := NIL
endif
return

NETIO works with all core RDDs (DBF, DBFFPT, DBFBLOB, DBFNTX, DBFCDX,
DBFNSX, SDF, DELIM) and any other RDD which inherits from above or
use standard RDD IO API (hb_file*() functions).
Without touching even single line in RDD code it gives the same
functionality as REDBFCDX in xHarbour but for all RDDs.
It's possible that such direct TCP/IP connection is faster then
file server protocols especially if they need more then one IP frame
to exchange data so it's one of the reason to use it in such cases.
Please make real speed tests.
The second reason to use NETIO server is resolving problem with
concurrent access to the same files using Harbour applications
compiled for different platforms, i.e. DOS, LINUX, Windows and OS2.
It's very hard to configure all client stations to use correct
locking system. NETIO fully resolves this problem so it can be
interesting alternative also for MS-Windows users only if they
do not want to play with oplocks setting on each station.
I'm interesting in user opinions about real life NETIO usage.

Have a fun with this new toy ;-)

+ harbour/contrib/hbnetio/tests
+ harbour/contrib/hbnetio/tests/netiotst.prg
+ harbour/contrib/hbnetio/tests/netiotst.hbp
+ harbour/contrib/hbnetio/tests/data
+ added simple test code for NETIO. It activates NETIO MT server
and then connects to this server to create and browse table with
memo file and production index with few tags.

Re: Harbour com DBF via TCP / IP

Enviado: 01 Set 2009 08:55
por software_facil
Depois dessa notícia, e já que o fórum anda meio indiano, só me resta dizer.... Hare Baba !!!

Re: Harbour com DBF via TCP / IP

Enviado: 01 Set 2009 12:19
por Itamar M. Lins Jr.
Irei aguradar mais alguns ajustes, para poder testar.
Sendo do Przmek, podemos crer que tem qualidade.

Saudações,
Itamar M. Lins Jr.

Re: Harbour com DBF via TCP / IP

Enviado: 01 Set 2009 20:08
por Hasse
Isto substituiria o LetoDB ?

E com enormes vantagens, pelo que entendi, correto ? Pois é nativo.

Re: Harbour com DBF via TCP / IP

Enviado: 02 Set 2009 01:21
por sygecom
Olá Hasse,
Hasse escreveu:Isto substituiria o LetoDB ?

E com enormes vantagens, pelo que entendi, correto ? Pois é nativo.
Aos pouco vamos conhecer mais essa nova modalidade, e aos poucos vamos juntos entender quando é ou não vantagem. Mas uma coisa que o proprio Prezmek já disse é que não vai ser como o Letodb, como uma solução Cliente/Servidor. No caso do Letodb, você não prescisa compartilhar uma pasta para ter acesso, e no caso do HbNetio, pelo que eu pude ver tem que está compartilhado sim, porem vai usar de recursos de Socket que deixara o uso dos RDD com respostas mais rapidas com poucas alterações.
Mas vamos acompanhar mais o HbNetio e veremos com o tempo todas suas vantagens.

Re: Harbour com DBF via TCP / IP

Enviado: 02 Set 2009 21:13
por Hasse
Realmente estou muito curioso e ansioso.

Dependendo, nem levo adiante o desenvolvimento com o LetoDb().

Re: Harbour com DBF via TCP / IP

Enviado: 03 Set 2009 08:22
por Itamar M. Lins Jr.
No caso do Letodb, você não prescisa compartilhar uma pasta para ter acesso, e no caso do HbNetio, pelo que eu pude ver tem que está compartilhado sim,
Creio que haja um equivoco aqui.
Se é via TCP não há necessidade de compartilhamento. Segundo eu entendi, NETIO é para resolver o problema de compartilhamento. Por exemplo não precisar mais montar uma pasta via SAMBA, e acessar via linux na mesma pasta e outra via windows. É bem similar ao LetoDB com menos recursos. "por enquanto...'

Saudações,
Itamar M. Lins Jr.

Re: Harbour com DBF via TCP / IP

Enviado: 04 Set 2009 12:53
por sygecom
Olá Itamar,
Itamar M. Lins Jr. escreveu: Creio que haja um equivoco aqui.
Se é via TCP não há necessidade de compartilhamento. Segundo eu entendi, NETIO é para resolver o problema de compartilhamento. Por exemplo não precisar mais montar uma pasta via SAMBA, e acessar via linux na mesma pasta e outra via windows. É bem similar ao LetoDB com menos recursos. "por enquanto...'
Pode ser que sim, não estudei ainda essa nova LIB e muito menos testei.

Re: Harbour com DBF via TCP / IP

Enviado: 12 Abr 2011 10:37
por JAIR RANGEL
Olá, Pessoal !

Estou testando a conexão dbf com netio - hmg3.0.35.
Quando abro em rede local, com tcp/ip, consigo conexão e abertura de arquivos.
A velocidade de abertura ficou legal.
Utilizei um arquivo com 105MB.
Porém, ainda não consegui estabelecer conexão via internet.
Estou utilizando os programas demo do hmg.3.0.35.
Achei interessante abrir os dbf via tcp/ip, uma vez que ainda não estou trabalhando com mysql.
Será que alguém do forum já testou dbf com netio via internet?

Abraço a todos....

Re: Harbour com DBF via TCP / IP

Enviado: 15 Abr 2011 19:18
por Itamar M. Lins Jr.
Sim,
Entre os desenvolvedores o Pritpal Bedi, testou e elogiou.
Criou até outro RDD.
Aqui ele explica os objetivos:
https://mail.google.com/mail/?hl=pt-BR& ... c8e1dfc900
Baixar em:
https://mail.google.com/mail/?hl=pt-BR& ... 4f0871bf0c

No entanto eu ainda uso o LetoDb.
Mas são todos boas opções.

Saudações,
Itamar M. Lins Jr.