[Spread-cvs] cvs commit: spread/daemon r.c
jonathan at spread.org
jonathan at spread.org
Mon Aug 26 21:11:40 EDT 2002
jonathan 02/08/27 01:11:40
Modified: daemon r.c
Log:
Enhance r to bind to specific interfaces for testing.
Add the -i option to control this.
Revision Changes Path
1.2 +12 -2 spread/daemon/r.c
Index: r.c
===================================================================
RCS file: /storage/cvsroot/spread/daemon/r.c,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- r.c 21 Aug 2001 14:28:21 -0000 1.1
+++ r.c 27 Aug 2002 01:11:40 -0000 1.2
@@ -46,6 +46,7 @@
static char IP[16];
static int16 Port;
static int32 Address;
+static int32 Interface_addr;
static int Detailed_report;
static void Usage( int argc, char *argv[] );
@@ -76,7 +77,7 @@
#endif /* ARCH_PC_WIN95 */
- chan = DL_init_channel( RECV_CHANNEL, Port, Address, 0 );
+ chan = DL_init_channel( RECV_CHANNEL, Port, Address, Interface_addr );
scat.num_elements = 1;
scat.elements[0].buf = buf;
@@ -151,6 +152,7 @@
/* Setting defaults */
Port = 4444;
Address = 0;
+ Interface_addr = 0;
Detailed_report= 0;
while( --argc > 0 )
{
@@ -170,10 +172,18 @@
Address = ( (i1 << 24 ) | (i2 << 16) | (i3 << 8) | i4 );
argc--; argv++;
+ }else if( !strncmp( *argv, "-i", 2 ) ){
+ sscanf(argv[1], "%s", IP );
+
+ sscanf( IP ,"%d.%d.%d.%d",&i1, &i2, &i3, &i4);
+ Interface_addr = ( (i1 << 24 ) | (i2 << 16) | (i3 << 8) | i4 );
+
+ argc--; argv++;
}else{
- printf( "Usage: r\n%s\n%s\n%s\n",
+ printf( "Usage: r\n%s\n%s\n%s\n%s\n",
"\t[-p <port number>] : to receive on, default is 4444",
"\t[-a <multicast class D address>] : if receiving multicast is desirable, default is 0",
+ "\t[-i <IP interface>] : set interface, default is 0",
"\t[-d ] : print a detailed report whenever messages are missed");
exit( 0 );
}
More information about the Spread-cvs
mailing list