From: Dalibor T. <dt...@fo...> - 2014-10-08 16:54:44
|
On 9/29/2014 3:02 PM, Denis wrote: > > Hi. I have wrote a background program for Linux for discovering > machines in a network using udp. The program is necessary because the > machines can have an address in a unknown network and I must find them. > > This is the server side program: > > TBSUdpSocket.bind('255.255.255.255', '65534'); > > if TBSUdpSocket.LastError<> 0 then WriteLn(TBSUdpSocket.LastErrorDesc) > else begin > > while not Terminated do begin > > StringIn:= TBSUdpSocket.RecvPacket(1000); > > And this is the client side: > > TBSUdpSocket.CreateSocket; > > TBSUdpSocket.EnableBroadcast(true); > > TBSUdpSocket.Connect('255.255.255.255', '65534'); > > TBSUdpSocket.SendString('_?'+ #10); > > TBSUdpSocket.Connect('255.255.255.255', '65534'); > > The program can discover machines only if the machines are in the same > network of the client. > > How can I find machines in a different network (multicast)? > > You have to scan over all Internet IP addresses. There is no other way (fortunatelly). -- Dalibor Toman |