Public Member Functions

HMulticastSocket Class Reference

A class for multicast communication. More...

#include <HMulticastSocket>

List of all members.

Public Member Functions

 HMulticastSocket (QObject *parent=0)
virtual ~HMulticastSocket ()
bool joinMulticastGroup (const QHostAddress &groupAddress)
bool joinMulticastGroup (const QHostAddress &groupAddress, const QHostAddress &localAddress)
bool leaveMulticastGroup (const QHostAddress &groupAddress)
bool leaveMulticastGroup (const QHostAddress &groupAddress, const QHostAddress &localAddress)
bool setMulticastTtl (quint8 arg)
bool bind (quint16 port=0)

Detailed Description

Remarks:
this class has thread-affinity, which mandates that the instances of this class has to be used in the thread in which they are located at the time.

Constructor & Destructor Documentation

HMulticastSocket ( QObject *  parent = 0 ) [explicit]

Constructs a new instance.

Parameters:
parentspecifies the parent QObject.
~HMulticastSocket (  ) [virtual]

Destroys the instance.


Member Function Documentation

bool joinMulticastGroup ( const QHostAddress &  groupAddress )

Attempts to joins into the specified multicast group address.

Parameters:
groupAddressspecifies the multicast group address.
Return values:
truein case the operation succeeded.
falsein case the operation failed. For instance, this happens when the socket is not bound to a port.
bool joinMulticastGroup ( const QHostAddress &  groupAddress,
const QHostAddress &  localAddress 
)

Attempts to joins into the specified multicast group address using the specified local address.

Parameters:
groupAddressspecifies the multicast group address.
localAddressspecifies the local addresses from which the join message is sent.
Return values:
truein case the operation succeeded.
falsein case the operation failed. For instance, this happens when the socket is not bound to a port.
bool leaveMulticastGroup ( const QHostAddress &  groupAddress )

Attempts to leave from the specified multicast group address.

Parameters:
groupAddressspecifies the multicast group address.
Return values:
truein case the operation succeeded.
falsein case the operation failed. For example, this happens when the socket has not joined to the specified multicast address.
bool leaveMulticastGroup ( const QHostAddress &  groupAddress,
const QHostAddress &  localAddress 
)

Attempts to leave from the specified multicast group address using the specified local address.

Parameters:
groupAddressspecifies the multicast group address.
localAddressspecifies the local addresses from which the leave message is sent.
Return values:
truein case the operation succeeded.
falsein case the operation failed. For example, this happens when the socket has not joined to the specified multicast address.
bool setMulticastTtl ( quint8  arg )

Attempts to set the Time To Live attribute for each message.

Parameters:
argspecifies the value for Time To Live.
Returns:
true in case the operation succeeded.
bool bind ( quint16  port = 0 )

Attempts to bind the socket into the specified port using BindMode flags and a QHostAddress value that are suitable for a multicast socket.

Parameters:
portspecifies the port to which to bind.
Returns:
true in case the operation succeeded.