Merge pull request #34 from vibe-d/udp_multicast

Implement the UDP multicast support methods.
This commit is contained in:
Sönke Ludwig 2017-09-05 16:00:07 +02:00 committed by GitHub
commit 1ed076d5cc
2 changed files with 6 additions and 3 deletions

View file

@ -4,7 +4,7 @@ authors "Sönke Ludwig"
copyright "Copyright © 2016, rejectedsoftware e.K." copyright "Copyright © 2016, rejectedsoftware e.K."
license "MIT" license "MIT"
dependency "eventcore" version="~>0.8.12" dependency "eventcore" version="~>0.8.16"
targetName "vibe_core" targetName "vibe_core"

View file

@ -790,7 +790,8 @@ struct UDPConnection {
*/ */
@property void multicastLoopback(bool loop) @property void multicastLoopback(bool loop)
{ {
assert(false, "not implemented."); enforce(eventDriver.sockets.setOption(m_socket, DatagramSocketOption.multicastLoopback, loop),
"Failed to set multicast loopback mode.");
} }
/** Become a member of an IP multicast group. /** Become a member of an IP multicast group.
@ -801,7 +802,9 @@ struct UDPConnection {
*/ */
void addMembership(ref NetworkAddress multiaddr) void addMembership(ref NetworkAddress multiaddr)
{ {
assert(false, "not implemented."); scope addr = new RefAddress(multiaddr.sockAddr, multiaddr.sockAddrMaxLen);
enforce(eventDriver.sockets.joinMulticastGroup(m_socket, addr),
"Failed to add multicast membership.");
} }
/** Stops listening for datagrams and frees all resources. /** Stops listening for datagrams and frees all resources.