Red Hat Cluster Suite : Test multicast between two hosts
id : zrkn0j7693
category : computer
blog : unixlinux
created : 05/31/11 - 10:17:58

  • Use attached file multicast.py.
  • Please ensure CMAN is stopped before testing multicast.

Host 1
  • Setup a server to receive multicast messages :
# ./multicast.py -I 192.168.0.1 -M 239.0.0.1 -s -p 5405 

    • I : Primary interface.
    • M : Multicast address.
    • p : Port. Please note the default port used 5405 is used by cman and starting this script with this port number while cman running and holding port 5405 will result the script exiting with port allocation failure.
Host 2
  • Same args as server.
  • Set up one or more clients to send multicast messages :
./multicast.py -I 192.168.0.2 -M 239.0.0.1 hello -p 5405
Mon, 04 Oct 2010 17:16:06 DEBUG    Joined the multicast network: 239.0.0.1 on 192.168.0.2
Mon, 04 Oct 2010 17:16:06 INFO     Sent data: '000000001 1286183766.53 hello'
Mon, 04 Oct 2010 17:16:07 INFO     Sent data: '000000002 1286183767.53 hello'
^CMon, 04 Oct 2010 17:16:15 INFO     Exiting...
Mon, 04 Oct 2010 17:16:15 DEBUG    Left the multicast network: 192.168.0.2 on 127.0.0.1

Host 1
  • Observe the message being received on the server :
./multicast.py -I 192.168.0.1 -M 239.0.0.1 -s -p 5405
Mon, 04 Oct 2010 17:15:18 DEBUG    Bound: 127.0.0.1:5405
Mon, 04 Oct 2010 17:15:18 DEBUG    Joined the multicast network: 239.0.0.1 on 192.168.0.1
Mon, 04 Oct 2010 17:16:06 INFO     Received 'hello' (#1) from 127.0.0.1:56339, time=0.001844
Mon, 04 Oct 2010 17:16:07 INFO     Received 'hello' (#2) from 127.0.0.1:56339, time=0.003399
^CMon, 04 Oct 2010 17:16:17 INFO     Exiting...
Mon, 04 Oct 2010 17:16:17 INFO     192.168.0.1:33585: Received = 2, (maybe) Lost = 0
Mon, 04 Oct 2010 17:16:17 DEBUG    Left the multicast network: 239.0.0.1 on 192.168.0.1