RTC Forums
May 16, 2024, 02:59:47 AM *
Welcome, Guest. Please login or register.

Login with username, password and session length
 
   Home   Help Login Register  
Pages: [1]
  Print  
Author Topic: Sender.LocalAddr = 0.0.0.0 in DataReceived event  (Read 3578 times)
HelgeLange
RTC Expired
*
Posts: 100


« on: June 25, 2017, 03:42:16 PM »

Hi Danijel,
before I try some other components to determine the local ip adress, i'd like to ask, what would be the rtc way to do it..

I build a small upd example for myself to see, if I can improve the existing code of a service I'm running in my client installations.
It's just UdpClient/Server and it works fine. But when I try to return the ip adress the server is running on, the LocalAddr function returns 0.0.0.0
Code:
procedure TForm5.RtcUdpServer1DataReceived(Sender: TRtcConnection);
var S: String;
begin
  S := Sender.Read;
  If S = 'huhu' Then
    Sender.Write(Sender.LocalAddr);
  CodeSite.Send( csmLevel4, 'Data', S);
end;

the server config is :

Code:
  object RtcUdpServer1: TRtcUdpServer
    MultiThreaded = True
    ServerPort = '10103'
    OnClientConnect = RtcUdpServer1ClientConnect
    OnDataReceived = RtcUdpServer1DataReceived
    Left = 152
    Top = 120
  end


Any ideas ?
Thanks in advance,
Helge
Logged
D.Tkalcec (RTC)
Administrator
*****
Posts: 1881


« Reply #1 on: June 25, 2017, 04:38:08 PM »

LocalAddr of the Server is irrelevant for the Client. What does matter is the PeerAddr you get on the Client after receiving data from the Server.

Best Regards,
Danijel Tkalcec
Logged
HelgeLange
RTC Expired
*
Posts: 100


« Reply #2 on: June 25, 2017, 04:48:56 PM »

So i mounted the horse from the wrong side Smiley
Thanks for the quick reply!

Helge
Logged
Pages: [1]
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.21 | SMF © 2015, Simple Machines Valid XHTML 1.0! Valid CSS!
Page created in 0.023 seconds with 17 queries.