Advertisement
ASP_Volume2 Internet/ HTML #36766

Multicast Functions using Winsock Control

Allows you to recieve multicast UDP packets.(Please vote and leave comments)

AI

AI Summary: This codebase represents a historical implementation of the logic described in the metadata. Our preservation engine analyzes the structure to provide context for modern developers.

Source Code
original-source
'To send a multicast you set winsock protocol to UDP with an address of 224.0.0.1 and set a port.
'Bind to any port...
'To set TTL call SockMulti_TTL using .SocketHandle from Winsock Control.
'To recieve a multicast, bind to the port that is to recieve on,set protocol to UDP, and Call SockADD_Membership using 224.0.0.1 as MultiAddr.
'To stop recieving multicast, call SockDRP_Membership using the same options you used to join.
'Use this to add membership to a multicast address.
Public Sub SockADD_Membership(SocketHandle As Long, MultiAddr As String, Optional LocalInterface As Long = 0)
Dim ip_m As ip_mreq
ip_m.imr_multiaddr = inet_addr(MultiAddr)
ip_m.imr_interface = LocalInterface 'Interface to join on
setsockopt SocketHandle, IP_PROTOIP, IP_ADD_MEMBERSHIP, ip_m, Len(ip_m)
End Sub
'Use this to drop membership to a multicast address.
Public Sub SockDRP_Membership(SocketHandle As Long, MultiAddr As String, Optional LocalInterface As Long = 0)
Dim ip_m As ip_mreq
ip_m.imr_multiaddr = inet_addr(MultiAddr)
ip_m.imr_interface = LocalInterface 'Interface to leave on
setsockopt SocketHandle, IP_PROTOIP, IP_DROP_MEMBERSHIP, ip_m, Len(ip_m)
End Sub
'Sets TTL for sends to multicast addresses.
Public Sub SockMulti_TTL(SocketHandle As Long, TTL As Long)
setsockopt SocketHandle, IP_PROTOIP, IP_MULTICAST_TTL, TTL, Len(TTL)
End Sub
Original Comments (3)
Recovered from Wayback Machine