develooper Front page | perl.perl5.porters | Postings from May 2003

SOCKET::INET code worked in 5.06 broken in 5.8

From:
Ken McNamara
Date:
May 1, 2003 08:00
Subject:
SOCKET::INET code worked in 5.06 broken in 5.8
Message ID:
3EB03687.182550CC@grandcanyonhiker.com
Posted this to the Win32 mailing list - but no one offered any fix.

I have a simple INET program that opens send and listen sockets on two
machines - then sends short messages between them.  (Unix to Windows
NT4)

It worked with MSwin32 ActiveState 5.06 but fails with ActiveState 5.8
(build 806 from ActiveState).

When the Unix box opens a receive socket, the Win32 connects and sends
no problem.  BUT...

When the Win32(NT4) box opens a receive socket
(IO::SOCKET::INET=GLOB(0x1c8c73c) - and waits for the Unix box to open
aconnection.

When the Unix box attempts to connect - the Win32 box responds with a
'Reset Connection' - The Win32 box gives the same response if the Unix
box attempts to connect to a non-exsistant port.

I've got a sniffer on the network to see the conversation between the
two systems (posted below).

Any suggestions or comments would really be appreciated.

Thank you.
-- 
     KenMc - conmara@grandcanyonhiker.com
       http://www.grandcanyonhiker.com
              See our new video -
'Hiking the Grand Canyon - The Corridor Trails'

CODE snip BELOW -----

use IO::Socket;

sub openlisten($portnum) {
        my $self = shift;
        my $portnum = shift;

        my $protocol = getprotobyname('tcp');
        my $rcvobj = IO::Socket::INET(
                        LocalAddr => 'localhost',
                        LocalPort => $portnum,
                        Proto => $protocol,
                        Listen => 5,
                        Reuse => 1
                        );

        if(!($rcvobj =~ /INET/) { return (undef,$!); }
        else { $self->{'rcvobj'} = $rcvobj; }

        return ($rcvobj);
}


####
Here is the conversation between Unix and Win32 box - note that it looks
the same if the Unix box
attempts to connect to a non-existant port
#####
                                                                        
Page 1
Protocol Decode Output
 
----- Decoding frame no: 1 ----
 
 
 
PktID Timestamp    Size Source Node       Destination Node  Protocol
Info.     
-------------------------------------------------------------------------------
    1 16:09:26.830 0064 unix box          win32             DoD TCP 
60613->2104
 
 
Frame 1 Size    64 Absolute Time Apr 29 16:09:26.830 ASCII MODE
-------------------------------------------------------------------------------
  00000: 00 80 5f 25 85 bd 08 00 20 87 90 a9 08 00 45 00   .._%....
.....E.
  00016: 00 2c 42 41 40 00 ff 06 cb be 90 96 26 62 90 96  
.,BA@.......&b..
  00032: 26 3d ec c5 08 38 16 ca df c1 00 00 00 00 60 02  
&=...8........`.
  00048: 22 38 1c 99 00 00 02 04 05 b4 55 55 ad a4 02 98  
"8........UU....
 
 
Frame 1 Size    64 Absolute Time Apr 29 16:09:26.830 ASCII MODE
-------------------------------------------------------------------------------
----- Level # 1 is ETHERNET Offset: 0 Size: 14
 
 Dest Address   : 00-80-5f-25-85-bd                00 80 5f 25 85 bd 
.._%..
 Source Address : Sun     -87-90-a9                08 00 20 87 90 a9  ..
...
 Type           : 2048 (DoD IP)                    08 00              ..
----- Level # 2 is DoD IP Offset: 14 Size: 20
 
 Version        : 4                                 4                 .
 Header Length  : 20                                5                 .
 Type Of Service: 0                                00                 .
                : 000..... Routine
                : ...0.... Normal Delay
                : ....0... Normal Throughput
                : .....0.. Normal Reliability
 Total Length   : 44                               00 2c              .,
 Identification : 16961                            42 41              BA
 Flags          : 2                                 2                 .
                : 0.. Reserved
                : .1. Don't Fragment
                : ..0 Last Fragment
 Fragment Offset: 0                                40 00              @.
 Time To Live   : 255                              ff                 .
 Protocol       : 6 (DODTCP)                       06                 .
 Header Checksum: 52158                            cb be              ..
 Source Address : unix box                         90 96 26 62       
..&b
 Dest Address   : win32                            90 96 26 3d       
..&=
----- Level # 3 is DoD TCP Offset: 34 Size: 24
 
 Source Port    : 60613                            ec c5              ..
 Dest Port      : 2104                             08 38              .8
 Seq Number     : 382394305                        16 ca df c1       
....
 Ack Number     : 0                                00 00 00 00       
....
 Data Offset    : 24                                6                 .
 Reserved       : 0                                 0                 .
 Flags          : 2                                02                 .
                : 0..... Invalid Urgent Ptr 
                : .0.... Invalid Ack Field
                : ..0... Push Not Requested
                : ...0.. Don't Reset Conn
                : ....1. Sync Seq No
                : .....0 Not Final Byte Stream
 Window         : 8760                             22 38              "8
 Checksum       : 7321                             1c 99              ..
 Urgent Ptr     : 0                                00 00              ..
 Option         : 2 [Maximum Segment Size]         02                 .
 Option Len     : 4                                04                 .
 Max Seg size   :                                  05 b4              ..
----- Level # 7 is UserData Offset: 58 Size: 6
 
  00048:                               55 55 ad a4 02 98            
UU....
 

#####  RESPONSE FROM win32 box #######
 
PktID Timestamp    Size Source Node       Destination Node  Protocol
Info.     
-------------------------------------------------------------------------------
    2 16:09:26.831 0064 win32             unix box          DoD TCP 
2104->60613
 
 
Frame 2 Size    64 Absolute Time Apr 29 16:09:26.831 ASCII MODE
-------------------------------------------------------------------------------
  00000: 08 00 20 87 90 a9 00 80 5f 25 85 bd 08 00 45 00   ..
....._%....E.
  00016: 00 28 65 6a 00 00 80 06 67 9a 90 96 26 3d 90 96  
.(ej....g...&=..
  00032: 26 62 08 38 ec c5 00 00 00 00 16 ca df c2 50 14  
&b.8..........P.
  00048: 00 00 56 7a 00 00 20 45 42 45 4a 45 c9 ae 93 5b   ..Vz..
EBEJE...[
 
 
Frame 2 Size    64 Absolute Time Apr 29 16:09:26.831 ASCII MODE
-------------------------------------------------------------------------------
----- Level # 1 is ETHERNET Offset: 0 Size: 14
 
 Dest Address   : Sun     -87-90-a9                08 00 20 87 90 a9  ..
...
 Source Address : 00-80-5f-25-85-bd                00 80 5f 25 85 bd 
.._%..
 Type           : 2048 (DoD IP)                    08 00              ..
----- Level # 2 is DoD IP Offset: 14 Size: 20
 
 Version        : 4                                 4                 .
 Header Length  : 20                                5                 .
 Type Of Service: 0                                00                 .
                : 000..... Routine
                : ...0.... Normal Delay
                : ....0... Normal Throughput
                : .....0.. Normal Reliability
 Total Length   : 40                               00 28              .(
 Identification : 25962                            65 6a              ej
 Flags          : 0                                 0                 .
                : 0.. Reserved
                : .0. May Fragment
                : ..0 Last Fragment
 Fragment Offset: 0                                00 00              ..
 Time To Live   : 128                              80                 .
 Protocol       : 6 (DODTCP)                       06                 .
 
 Header Checksum: 26522                            67 9a              g.
 Source Address : win32                            90 96 26 3d       
..&=
 Dest Address   : unix box                         90 96 26 62       
..&b
----- Level # 3 is DoD TCP Offset: 34 Size: 20
 
 Source Port    : 2104                             08 38              .8
 Dest Port      : 60613                            ec c5              ..
 Seq Number     : 0                                00 00 00 00       
....
 Ack Number     : 382394306                        16 ca df c2       
....
 Data Offset    : 20                                5                 .
 Reserved       : 0                                 0                 .
 Flags          : 20                               14                 .
                : 0..... Invalid Urgent Ptr 
                : .1.... Valid Ack Field
                : ..0... Push Not Requested
                : ...1.. Reset Conn
                : ....0. Don't Sync Seq No
                : .....0 Not Final Byte Stream
 Window         : 0                                00 00              ..
 Checksum       : 22138                            56 7a              Vz
 Urgent Ptr     : 0                                00 00              ..
----- Level # 7 is UserData Offset: 54 Size: 10
 
  00048:                   20 45 42 45 4a 45 c9 ae 93 5b         
EBEJE...[



nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About