Re: [twsocket] When receiving UDP datas, find if there were sent through a broadcast

2014-02-26 Thread Eric-Lionel Rault

I don't think this exists. However, I see two solutions for your problem:
One easy and one more complex.
1) Easy: In the data packet you send, add the server address. Those not
having that address will then easily detected. This is easy but required 
to

somewhat change the protocol you use and this may not be possible for you.


Good news, i found out that in my data packets, i had already a flag for 
that !



2) Complex: Use a second TWSocket in raw mode to get hand on all packets.
You can then peek in the raw packet to find the destination address which 
is

255.255.255.255.


Complex, i agree 



--
To unsubscribe or change your settings for TWSocket mailing list
please goto http://lists.elists.org/cgi-bin/mailman/listinfo/twsocket
Visit our website at http://www.overbyte.be


Re: [twsocket] When receiving UDP datas, find if there were sent through a broadcast

2014-02-26 Thread François Piette
>> I don't believe there is anything in the IP protocol that will 
>> identify a broadcast

> If not, is there a flag somewhere in twsocket  to tell an UDP socket 
> to ignore clients who knocks on a given port with a 255.255.255.255
address ?

I don't think this exists. However, I see two solutions for your problem:
One easy and one more complex.
1) Easy: In the data packet you send, add the server address. Those not
having that address will then easily detected. This is easy but required to
somewhat change the protocol you use and this may not be possible for you.

2) Complex: Use a second TWSocket in raw mode to get hand on all packets.
You can then peek in the raw packet to find the destination address which is
255.255.255.255.

-- 
francois.pie...@overbyte.be
Embarcadero MVP
http://www.overbyte.be
http://francois-piette.blogspot.com





-- 
To unsubscribe or change your settings for TWSocket mailing list
please goto http://lists.elists.org/cgi-bin/mailman/listinfo/twsocket
Visit our website at http://www.overbyte.be


Re: [twsocket] When receiving UDP datas, find if there were sent through a broadcast

2014-02-26 Thread Angus Robertson - Magenta Systems Ltd
> If not, is there a flag somewhere in twsocket  to tell an UDP 
> socket to ignore clients who knocks on a given port with a 
> 255.255.255.255 address ?

The only addresses provided by the protocol are source and destination, I don't
know broadcasting is implemented, but would assume it's down to ARP tables of
MAC addresses on the LAN.  

Angus

-- 
To unsubscribe or change your settings for TWSocket mailing list
please goto http://lists.elists.org/cgi-bin/mailman/listinfo/twsocket
Visit our website at http://www.overbyte.be


Re: [twsocket] When receiving UDP datas, find if there were sent through a broadcast

2014-02-26 Thread Eric-Lionel Rault

Angus,

 you can either arrange the clients tell you as part of the data you 
send

seems to be the simplest solution but needs to change the client software.

 use a different port for broadcasts

also needs to change the client software.

keep track of the IP addresses locally

in action already.

I don't believe there is anything in the IP protocol that will identify a 
broadcast
If not, is there a flag somewhere in twsocket  to tell an UDP socket to 
ignore clients who knocks on a given port with a 255.255.255.255 address ?


Lionel


--
To unsubscribe or change your settings for TWSocket mailing list
please goto http://lists.elists.org/cgi-bin/mailman/listinfo/twsocket
Visit our website at http://www.overbyte.be


Re: [twsocket] When receiving UDP datas, find if there were sent through a broadcast

2014-02-25 Thread Angus Robertson - Magenta Systems Ltd
> I have a server with an UDP socket listening.
> Some Clients connect with the Ip address of the server : Direct 
> Addressing.
> Some Clients do not know the Ip address of the server, therefore 
> they connect by sending a broadcast.
> In OnDataAvailable event, i would like to know which Clients have 
> been connected through a broadcast.

I don't believe there is anything in the IP protocol that will identify a
broadcast.  So you can either arrange the clients tell you as part of the data
you send, use a different port for broadcasts, or keep track of the IP
addresses locally (if you know already). 

In DataAvailable, you can use ReceiveFrom the get the IP address of the remote
client. 

Angus

-- 
To unsubscribe or change your settings for TWSocket mailing list
please goto http://lists.elists.org/cgi-bin/mailman/listinfo/twsocket
Visit our website at http://www.overbyte.be


[twsocket] When receiving UDP datas, find if there were sent through a broadcast

2014-02-25 Thread Eric-Lionel Rault
Hi,

I have a server with an UDP socket listening.

Some Clients connect with the Ip address of the server : Direct Addressing.
Some Clients do not know the Ip address of the server, therefore they connect 
by sending a broadcast.

In OnDataAvailable event, i would like to know which Clients have been 
connected through a broadcast.
 
procedure TFormprin.WSocketServerUDPDataAvailable(Sender: TObject; Error: Word);
begin
if  .. then panel1.caption:='Broadcast' else panel1.caption:='Direct 
addressing';
end;

How can i achieve this ? 

Thanks,

Lionel
-- 
To unsubscribe or change your settings for TWSocket mailing list
please goto http://lists.elists.org/cgi-bin/mailman/listinfo/twsocket
Visit our website at http://www.overbyte.be