Moderador: Moderadores
Creio que não. Mas como você está em fase de testes, seria interessante se você indexasse esse arquivo e repetisse os testes, e reportasse aqui. Reporte também se funcionou ou não o comando HardCommit,assim ficaria para registro a outros que venham ter esse problema.bwr2018 escreveu:Esse banco não uso nenhum tipo de index nele, [...]. Será que é por isso?
#define FILE_LOCAL "/home/bruno/server/banco.dbf"
#define FILE_LETODB "/usr/local/bin/letodb"
#define FILE_SERVER "banco.dbf"
#define NETSERVER "192.168.0.1"
#define NETPORT "2812"
request RDDLETO
memvar getlist
field INCSERV1
field INCSERV2
field INCSERV3
field INCSERV4
field INCSERV5
field INCSERV6
field INCSERV7
field INCLOCAL1
field INCLOCAL2
field INCLOCAL3
field INCLOCAL4
field INCLOCAL5
field INCLOCAL6
field INCLOCAL7
procedure main(param1)
local secs,tk
set date british
set date format "dd/mm/yyyy"
set century on
init_database()
if ( empty( param1 ) )
cls
? "./browse 0 - para iniciar como servidora"
? "./browse 1 - para iniciar como estacao"
quit
endif
if ( param1 == '0' )
init_service_leto()
endif
if leto_Connect( "//"+NETSERVER+":"+NETPORT+"/" ) == -1
alert("Sem conexao")
clear all
close all
quit
endif
cls
secs := abs(seconds())
do while .t.
tk := inkey(0.1)
if tk == 27
quit
endif
if tk == 13
dbselectarea("W")
dbxput( "INCLOCAL1", INCLOCAL1 + 1 )
dbxput( "INCLOCAL2", INCLOCAL2 + 1 )
dbxput( "INCLOCAL3", INCLOCAL3 + 1 )
dbxput( "INCLOCAL4", INCLOCAL4 + 1 )
dbxput( "INCLOCAL5", INCLOCAL5 + 1 )
dbxput( "INCLOCAL6", INCLOCAL6 + 1 )
dbxput( "INCLOCAL7", INCLOCAL7 + 1 )
USE FILE_SERVER SHARED NEW ALIAS LAN
if neterr() .or. empty( alias() )
alert("Erro ao abrir banco de dados")
else
dbselectarea("LAN")
endif
dbxput_server( "INCSERV1", INCSERV1 + 1 )
dbxput_server( "INCSERV2", INCSERV2 + 1 )
dbxput_server( "INCSERV3", INCSERV3 + 1 )
dbxput_server( "INCSERV4", INCSERV4 + 1 )
dbxput_server( "INCSERV5", INCSERV5 + 1 )
dbxput_server( "INCSERV6", INCSERV6 + 1 )
dbxput_server( "INCSERV7", INCSERV7 + 1 )
update_dbf()
LAN->( dbclosearea() )
endif
if abs( seconds() - secs ) > 0.3
dbselectarea("W")
@ 0,43 say "BANCO LOCAL"
@ 2,41 say "INCREMENTO 1: "+alltrim(str(INCLOCAL1))
@ 3,41 say "INCREMENTO 2: "+alltrim(str(INCLOCAL2))
@ 4,41 say "INCREMENTO 3: "+alltrim(str(INCLOCAL3))
@ 5,41 say "INCREMENTO 4: "+alltrim(str(INCLOCAL4))
@ 6,41 say "INCREMENTO 5: "+alltrim(str(INCLOCAL5))
@ 7,41 say "INCREMENTO 6: "+alltrim(str(INCLOCAL6))
@ 8,41 say "INCREMENTO 7: "+alltrim(str(INCLOCAL7))
USE FILE_SERVER SHARED NEW ALIAS LAN
if neterr() .or. empty( alias() )
alert("Erro ao abrir banco de dados")
else
dbselectarea("LAN")
endif
@ 0,3 say "BANCO SERVIDOR"
@ 2,1 say "INCREMENTO 1: "+alltrim(str(INCSERV1))
@ 3,1 say "INCREMENTO 2: "+alltrim(str(INCSERV2))
@ 4,1 say "INCREMENTO 3: "+alltrim(str(INCSERV3))
@ 5,1 say "INCREMENTO 4: "+alltrim(str(INCSERV4))
@ 6,1 say "INCREMENTO 5: "+alltrim(str(INCSERV5))
@ 7,1 say "INCREMENTO 6: "+alltrim(str(INCSERV6))
@ 8,1 say "INCREMENTO 7: "+alltrim(str(INCSERV7))
LAN->( dbclosearea() )
secs := abs( seconds() )
endif
enddo
leto_disconnect()
quit
procedure init_service_leto
cls
? "Iniciando letodb..."
hb_run(FILE_LETODB)
? "Letodb iniciado...."
inkey(3)
return
procedure init_database
local cDbf_File := "banco.dbf"
if file(cDbf_File)
dbusearea(.t., NIL, cDbf_File, "W", NIL, .f.)
else
cls
alert(cDbf_File+" nao encontrada!")
quit
endif
return
procedure dbxput(local1,local2)
field->&local1 := local2
return
procedure dbxput_server(cField, xValor)
do while .t.
if ( LAN->( dbrlock() ) )
field->&cField := xValor
LAN->( dbunlock() )
exit
else
alert("Sem conexao")
exit
endif
enddo
return
procedure update_dbf
dbcommitall()
return
-obrowse
-w3
-es2
-lrddleto
browse.prg
//REQUEST DBFCDX
memvar getlist
procedure main
local aDbf := {}
set date british
set date format "dd/mm/yyyy"
setcancel(.f.)
set century on
aadd(aDbf,{"INCSERV1" , "N", 12, 4})
aadd(aDbf,{"INCSERV2" , "N", 12, 4})
aadd(aDbf,{"INCSERV3" , "N", 12, 4})
aadd(aDbf,{"INCSERV4" , "N", 12, 4})
aadd(aDbf,{"INCSERV5" , "N", 12, 4})
aadd(aDbf,{"INCSERV6" , "N", 12, 4})
aadd(aDbf,{"INCSERV7" , "N", 12, 4})
ferase("base.dbf")
//dbCreate( "base.dbf", aDbf, "DBFCDX", .T., "W" )
DbCreate("base.dbf", aDbf,,.t.,"W")
W->(dbAppend())
W->INCSERV1 := 0
W->INCSERV2 := 0
W->INCSERV3 := 0
W->INCSERV4 := 0
W->INCSERV5 := 0
W->INCSERV6 := 0
W->INCSERV7 := 0
commit
clear all
close all
quit
bwr2018 escreveu:Olá, e qual é a diferença amigo?
Agora esse caso do travamento caso a conexão com o servidor seja perdida isso é bem ruim acaba inviabilizando o uso da ferramenta.
HardCommit = 0 - if 0, SET HARDCOMMIT OFF, this is now DEFAULT.
It is recommended for UNSTABLE running server to set it to <1>,
which means that each change at data tables are immedeate written to
harddrive bypassing the OS cache.
Expect significant reduced performance with setting '1'.
Será que existe algum tratamento para isso alguma maneira de esta sempre verificando se a conexão ainda esta ativa?
LETO_DETECT( [ cService ],[ nNrOfPossible ],[ nPort ] ) ==> cServerIP
This functions sends a broadcast into the local network, to all available interfaces,
(virtual) interfaces loopback (lo) and other without MAC address are excluded from that.
Default <cService> is "letodb", and this is correlating to the server side:
see in example letodb.ini for config option: BC_Services = letodb;
Such configured LetoDBf server then will respond to this query with its IP/Port,
where <cServerIP> is in the format: "//9.9.9.9:2812/" to be used i.e. to connect
to the server: Leto_Connect( Leto_Detect() ),
With <nNrOfPossible> can be selected between multiple server responding to same service name.
Alternative to new build-in at server was before a standalone exe: 8.2. 'Uhura'
Para verificar se a conexão está ativa basta usar a dica do Itamar acima, já para evitar o "travamento", basta NÃO usar TimeOut = -1.bwr2018 escreveu: Agora esse caso do travamento caso a conexão com o servidor seja perdida isso é bem ruim acaba inviabilizando o uso da ferramenta. Será que existe algum tratamento para isso alguma maneira de esta sempre verificando se a conexão ainda esta ativa?
TimeOut = -1 - Connection timeout in seconds, -1 means infinite wait.
This timeout determine, how long a write to network/ wait for requested workarea
will wait to succeed, before the thread for the connection give up.
If used: Zombie_Check, this value shell be shorter than that.
Itamar M. Lins Jr. escreveu:Ola!Agora esse caso do travamento caso a conexão com o servidor seja perdida isso é bem ruim acaba inviabilizando o uso da ferramenta.
E é para acontecer o quê neste caso ? Eu não estou entendendo.HardCommit = 0 - if 0, SET HARDCOMMIT OFF, this is now DEFAULT.
It is recommended for UNSTABLE running server to set it to <1>,
which means that each change at data tables are immedeate written to
harddrive bypassing the OS cache.
Expect significant reduced performance with setting '1'.Será que existe algum tratamento para isso alguma maneira de esta sempre verificando se a conexão ainda esta ativa?
No caso da pergunta acima, a resposta está no capitulo 7.1 do arquivo Readme.txt do LetoDbf.
Mas continuo sem entender nada. A Conexão tem ficar ativa o tempo TODO mesmo, se cair congela a aplicação! Não é assim com qualquer programa ?
Qual é o programa que "em usando" a rede e a conexão cair, continua funcionando ?LETO_DETECT( [ cService ],[ nNrOfPossible ],[ nPort ] ) ==> cServerIP
This functions sends a broadcast into the local network, to all available interfaces,
(virtual) interfaces loopback (lo) and other without MAC address are excluded from that.
Default <cService> is "letodb", and this is correlating to the server side:
see in example letodb.ini for config option: BC_Services = letodb;
Such configured LetoDBf server then will respond to this query with its IP/Port,
where <cServerIP> is in the format: "//9.9.9.9:2812/" to be used i.e. to connect
to the server: Leto_Connect( Leto_Detect() ),
With <nNrOfPossible> can be selected between multiple server responding to same service name.
Alternative to new build-in at server was before a standalone exe: 8.2. 'Uhura'
Saudações,
Itamar M. Lins Jr.
Jairo Maia escreveu:Para verificar se a conexão está ativa basta usar a dica do Itamar acima, já para evitar o "travamento", basta NÃO usar TimeOut = -1.bwr2018 escreveu: Agora esse caso do travamento caso a conexão com o servidor seja perdida isso é bem ruim acaba inviabilizando o uso da ferramenta. Será que existe algum tratamento para isso alguma maneira de esta sempre verificando se a conexão ainda esta ativa?
Assim, quando perder a conexão com o servidor o comportamento será como qualquer outro sistema, como sua internet por exemplo, ou seja, "morre tudo".TimeOut = -1 - Connection timeout in seconds, -1 means infinite wait.
This timeout determine, how long a write to network/ wait for requested workarea
will wait to succeed, before the thread for the connection give up.
If used: Zombie_Check, this value shell be shorter than that.
asimoes escreveu:Por acaso trabalha com plugin de banco ? gaspro ou outro ?, antivirus também interfere, isso acontece em mais de uma estação ?
Usuários vendo este fórum: Nenhum usuário registrado online e 19 visitantes