Changeset 9028 for trunk/IO-Socket-Multicast
- Timestamp:
- 11/03/09 01:00:34 (2 years ago)
- Location:
- trunk/IO-Socket-Multicast/t
- Files:
-
- 1 added
- 1 edited
-
03_multicast.t (modified) (4 diffs)
-
04_send.t (added)
Legend:
- Unmodified
- Added
- Removed
-
trunk/IO-Socket-Multicast/t/03_multicast.t
r9023 r9028 9 9 use IO::Socket::Multicast; 10 10 11 # Simple constructor 12 my $s = IO::Socket::Multicast->new; 13 isa_ok( $s, 'IO::Socket::Multicast' ); 11 my $MCAST_ADDR = '225.0.0.1'; 12 my $MCAST_PORT = 9999; 13 14 # I think winsock prefers the socket 15 # to be bound to _something_ 16 my $s = IO::Socket::Multicast->new( 17 LocalPort => $MCAST_PORT, 18 LocalAddr => $MCAST_ADDR, 19 ReuseAddr => 1, 20 ); 14 21 15 22 # Platform compatibility … … 20 27 my $INTERFACE = $IO_INTERFACE && find_a_mcast_if($s); 21 28 29 30 isa_ok( $s, 'IO::Socket::Multicast' ); 31 32 ok($s->mcast_add($MCAST_ADDR), 'Add socket to Multicast Group' ); 33 ok($s->mcast_drop($MCAST_ADDR),'Drop Multicast Group' ); 34 22 35 # Some basics 23 36 SKIP: { 24 37 # Windows doesn't return true for stuff 25 skip("Doesn't work on Win32??", 3) if $WIN32; 26 ok($s->mcast_add('225.0.1.1'), 'Add socket to Multicast Group' ); 27 ok($s->mcast_drop(inet_aton('225.0.1.1')),'Drop Multicast Group' ); 28 ok( ! $s->mcast_drop('225.0.1.1'), 'Drop unsubscribed group returns false' ); 38 skip("Doesn't work on Win32??", 1) if $WIN32; 39 ok( ! $s->mcast_drop($MCAST_ADDR), 'Drop unsubscribed group returns false' ); 29 40 } 30 41 … … 47 58 ok ($s->mcast_if($INTERFACE) eq 'any', 'Multicast interface set returns previous value'); 48 59 ok ($s->mcast_if eq $INTERFACE , 'Multicast interface set'); 49 ok ($s->mcast_add( '225.0.1.1',$INTERFACE), 'Multicast add GROUP,if');60 ok ($s->mcast_add($MCAST_ADDR,$INTERFACE), 'Multicast add GROUP,if'); 50 61 } 51 62 … … 56 67 next unless $s->if_flags($_) & IFF_MULTICAST(); 57 68 next unless $s->if_flags($_) & IFF_RUNNING(); 58 next unless $s->if_addr($_); 69 next unless $s->if_addr($_); # Having an address seems important 59 70 return $_; 60 71 }
Note: See TracChangeset
for help on using the changeset viewer.
