Question

I want to read syslog from UDP on port 514. I am using delphi 2010. I put an IdUDPServer and set DefaultPort with 514 and BuffeSize with 1024. this syslog is generated by Cisco firewall 5505. I am sending ping to my firewall like this command. Ping 192.168.1.100 -t when I run the kiwi (a software which is monitoring syslog messages) I get 2 message for each ping like this.

%ASA-6-302021: Teardown ICMP connection for faddr 192.168.1.4/1 gaddr 192.168.1.100/0 laddr 192.168.1.100/0 %ASA-6-302020: Built inbound ICMP connection for faddr 192.168.1.4/1 gaddr 192.168.1.100/0 laddr 192.168.1.100/0

but in my Listener I just get one message for each ping. like this %ASA-6-302020: Built inbound ICMP connection for faddr 192.168.1.4/1 gaddr 192.168.1.100/0 laddr 192.168.1.100/0

I don't know why I can't get the first message in my listener. I wrote my code like this on OnRead event of the IdUDPServer

procedure TMyTestOnSyslog.Listener514UDPRead(
  AThread: TIdUDPListenerThread; AData: TBytes; ABinding: TIdSocketHandle);
var S:string;
    i:Integer;
begin
  S:='';
  for i := 0 to High(AData) do
    S:=S+chr(Adata[i]);
  ...
end;

what should I do? :D

Was it helpful?

Solution

I am disappointed when one of when I called one of my friends and asked about this matter. he said better to not use Indy in delphi, because it is bugy. so I searched for the other components. there is an open source one. ICS(Internet Component Suite) which is working very well. you can get this open source for any delphi version or C++ Builder!

see this : http://www.overbyte.be/

in product part select ICS and you can download the latest version. fortunately it has many component and it has TSysLogServer. it doesn't lose any packet of UDP. it is true that UDP doesn't guarantee no loss for packets. but when I see other programs like kiwi and wiresharks get the packets properly I should know that the source of the problem in my program is the component.

so the answer for my question is: DON'T USE INDY !!!

I don't know Indy just in delphi have problems like this or in other languages is same. :|

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top