BorlandTalk.com Forum Index BorlandTalk.com
Borland discussion newsgroups
 
Archives   FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

UDP Server + Indy 10 + Delphi 7

 
Post new topic   Reply to topic    BorlandTalk.com Forum Index -> Delphi Internet Winsock
View previous topic :: View next topic  
Author Message
Martin
Guest





PostPosted: Tue May 08, 2007 11:20 pm    Post subject: UDP Server + Indy 10 + Delphi 7 Reply with quote



Hello

I need to create a udp server that could write to a postgres database (using
zeos lib components) the packets.(like a log). The packets arrive at server,
1 or 2 packets in 1 second. (Thread operation?)
I'll tried to do that in OnUDPRead event, but It dosn't work well.
Anyone have an example to read how to do that ?
The program need to run as a UDP Server Service. Now I test it in a normal
form.

Thanks you a lot!

Martin
Back to top
Remy Lebeau (TeamB)
Guest





PostPosted: Tue May 08, 2007 11:57 pm    Post subject: Re: UDP Server + Indy 10 + Delphi 7 Reply with quote



"Martin" <anchordoquim (AT) arnet (DOT) com.ar> wrote:

Quote:
The packets arrive at server, 1 or 2 packets in
1 second. (Thread operation?)

TIdUDPServer is multi-threaded, yes.

Quote:
I'll tried to do that in OnUDPRead event

Try to do what exactly?

Quote:
It dosn't work well.

Why not? You ned to be more specific. Just saying that something does not work says nothing about the actual problem you are having with it.


Gambit
Back to top
Martin
Guest





PostPosted: Wed May 09, 2007 12:18 am    Post subject: Re: UDP Server + Indy 10 + Delphi 7 Reply with quote



Quote:
I'll tried to do that in OnUDPRead event
I have a Zconnection + tztable in the main form.


in OnUDPRead I try to create a log in a database (Postgresql) using zeoslib
component.

procedure TForm1.IdUDPServer1UDPRead(Sender: TObject; AData: TIdBytes;
ABinding: TIdSocketHandle);
var cc,mpo : Integer;
s : string;
begin
mIP := ABinding.PeerIP +':'+ IntToStr(ABinding.peerport);

if aIndiceSig > 0 then
begin
mpo := BinSearch(mIP); // Busqueda Binaria
if mpo = -1 then
mpo := 0;
end
else
begin
// Agrego Indice
if aIndiceSig > RICS+1 then
aIndiceSig := 0;
mpo := aIndiceSig;
aIndice[aIndiceSig,0]:= mIP;
aIndice[aIndiceSig,1]:= IntToStr(aIndiceSig);
Inc(aIndiceSig);
// Aqui corro rutina de indexado Quicksort
QuickSort(0,aIndiceSig-1);
end;

//agrego datos al paquete
s := adatos[mpo] + BytesToString(AData);
aDatos[mpo]:= s;

Analizo(s,mpo);
end;

In Analizo Procedure I try to write to database.

procedure Tform1.Analizo(paquete:string; posic: Integer);
begin
....
TMovimientos.Insert;
TMovimientosid_nro.Value := nro;
...
TMovimientos.Post;

end;

The program insert the first record and show it in a Grid, and freeze, but
dont comit the record to DB.

Thank for your help Gambit.
Back to top
Remy Lebeau (TeamB)
Guest





PostPosted: Wed May 09, 2007 8:11 am    Post subject: Re: UDP Server + Indy 10 + Delphi 7 Reply with quote

"Martin" <anchordoquim (AT) arnet (DOT) com.ar> wrote in message
news:4640cd09 (AT) newsgroups (DOT) borland.com...

Quote:
I have a Zconnection + tztable in the main form.
snip
The program insert the first record and show it in a Grid,
and freeze, but dont comit the record to DB.

What you have described has nothing to do with Indy, and this is not a
socket issue. You are having troubles with the database components
instead. You need to talk to the component authors about any problems
with them, or ask in the database newsgroups.



Gambit
Back to top
Display posts from previous:   
Post new topic   Reply to topic    BorlandTalk.com Forum Index -> Delphi Internet Winsock All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2006 phpBB Group
SEO toolkit © 2004-2006 webmedic.