Friday, 15 March 2013

java - What is the 'wildcard address' In the context of UDP Broadcasts? -



java - What is the 'wildcard address' In the context of UDP Broadcasts? -

referring java 6 api docs datagramsocket class:

udp broadcasts sends enabled on datagramsocket. in order receive broadcast packets datagramsocket should bound wildcard address. in implementations, broadcast packets may received when datagramsocket bound more specific address.

could tell me 'wildcard address' is? , next valid listening udp broadcasts:

multicastsocket socket = new multicastsocket(new inetsocketaddress(inetaddress.getbyname("0.0.0.0"),4445);

the wildcard address 0.0.0.0. not confused broadcast-to-all-subnets address, 255.255.255.255. more correctly called 'any' address, after inaddr_any.

in java used supplying null bind-address, or omitting parameter altogether, e.g. new inetsocketaddress(null, 0) or new inetsocketaddress(0) respectively. in other words default when binding, , hence implicitly 'good practice'.

java network-programming broadcast multicast datagram

No comments:

Post a Comment