Good day! There is a machine with microtic OS. On which Traffic Traffic Sensor is configured which sends data to IP 10.10.10.10 port 9996 (I do not know for sure but I think that the UDP protocol is used). I think quite a few people wondered to build their own collector that will display the data in the form in which we want to see them! I tried to write something of my own, but it didn’t give any results :(. I used the IdUDPServer1 component. I would just like to output to the Memo what the microtic sends

uses idSocketHandle procedure TForm1.IdUDPServer1UDPRead(AThread: TIdUDPListenerThread; AData: TBytes; ABinding: TIdSocketHandle); var s: String; i:Integer; begin s := ''; try i := 0; while (AData[i] <> 0) do begin s := s + chr(AData[i]); i := i + 1; end; finally Memo1.Lines.Add(s); end; end; 

When I start, I see that the cursor is running to the bottom in the Memo field, but the data is not output :(. Maybe I am using the wrong component or do other components already exist for this business?

  • Put the traffic monitor on 10.10.10.10 (for example, Wireshark) and you will get something and in what form, on which protocol ... The component is most likely not the one, you don’t have a server, but the client on a 10.10.10.10 machine should - Dex

1 answer 1

The component is used, IdUDPServer ... The Server and Client components from the Indy series are not a server and a client in the usual way: here the client only sends data, and the server only accepts. If the cursor runs down, then some data is received. Most likely, Memo just can not display them (non-printable characters). I advise you to save the file to the data, and then simply open it with any HEX editor — then it will be known exactly what was accepted. And instead of the Memo1.Lines.Add (s) command, it is better to use Memo1.Text: = Memo1.Text + s, then there will not be any extra line breaks.