Kipp, James wrote: > I am trying to hand pack an net addr. On the server end (linux - > i386) it works fine.: > $addr = pack($template,AF_INET,$port,$iaddr); > bind(MY_SOCKET, $addr) || die "$0: Cannot bind .. $!\n"; -- > on the client end (win2k - i386) it fails. > -- > $template = 'S n C4 x8';
Your template is wrong. You need 'x C n a4 x8' (or 'n n a4 x8'). The returned value from gethostbyname is already packed, so C4 is wrong. The first two bytes are length (0) and family, both of which are unsigned char, so 'x C' (or 'n') handles those. Use IO::Socket man! Or sockaddr_in() at the very least! > $port = 6668; > $proto = getprotobyname('tcp'); > $addr = (gethostbyname("10.1.101.12"))[4]; > $remote = pack($template,AF_INET,$port,$addr); > socket(SOCK,AF_INET,SOCK_STREAM,$proto) || > die "$0: Cannot open socket\n"; > connect(SOCK, $remote) or die "can't connect: $!\n"; -- > the only error i get is: > Argument "\n^Ae\f" isn't numeric in pack at client.pl line 17. can't > connect: Unknown error. which doesn't tell me anything. i get a > similar warning about the non numeric on the server end but it works > fine. It works if use 'inet_aton' and 'sockaddr_in' on the addr/port, > but just curious why the pack is not working.. > > Thanks -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]