netdemo

Eric Norum norume at aps.anl.gov
Wed Nov 12 14:31:00 UTC 2003


aling wrote:
> I use "netdemo" to test the network driver.
>  In test.c,there is:
> #define DATA_SINK_HOST ((128 < <  24) | (233 < <  16) | (14 < <  8) | 60)
> 
> static void
> transmitTcp(void)
> {
> .....
>     farAddr.sin_family = AF_INET;
>   farAddr.sin_port = htons (9); /* The `discard' port */
>   farAddr.sin_addr.s_addr = htonl (DATA_SINK_HOST);
>   printf ("Connect socket.\n");
>    if (connect (s, (struct sockaddr *)&farAddr, sizeof farAddr) <  0) {
>    printf ("Can't connect socket: %s\n", strerror (errno));
>   close (s);
>   return;
>   }
> -----
> }
> 
> At first,I didn't change them and ran them.When I typed 't',the following information was on the target console .
> "t
> Create socket.
> Bind socket.
> Connect socket.
> Can't connect socket: Connection timed out
> "
> Then , I changed  "#define DATA_SINK_HOST ((128 < <  24) | (233 < <  16) | (14 < <  8) | 60)" into 
> "#define DATA_SINK_HOST ((192 < <  24) | (168 < <  16) | (1 < <  8) | 30)".
> The IP address of  my host is 192.168.1.30.
> the output information:
> "t
> Create socket.
> Bind socket.
> Connect socket.
> Can't connect socket: Connection rejected.
> "
> I am anxious to get your help.
> 

Your target machine (192.168.1.30) isn't listening on the TCP 'discard' port (9).  This is the way machines are often shipped nowadays as a security policy (don't turn on a service unless it is really needed).   To get the test program working you'll need to figure out how to turn on this service on the target machine.

-- 
Eric Norum                                 norume at aps.anl.gov
Advanced Photon Source                     Phone: (630) 252-4793
Argonne National Laboratory




More information about the users mailing list