Kipp, James wrote:
> > > $template = 'S n C4 x8';
> > 
> > Your template is wrong. You need 'x C n a4 x8' (or 'n n a4 x8').
> Thanks, I will give that a shot. Altough, all of the docs that i read
> pack the structure with the 'S n C4 x8' template

Is that in the Perl docs somewhere?

The first S will only work on big-endian architectures (not i386).

C4 expects four separate arguments in the range 0-255 for the address, not a
packed 4-byte string as returned by gethostbyname().

> and it does work on the Server end.

I suspect it "works" only by luck; you're probably using INADDR_ANY on your
bind() call, right? Is the server big-endian?

> 
> > 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!
> 
> I know, but I am just seeing if I can make it work by hand.
> call me crazy :)

Trying to do the pack() is just dangerous, IMO. You might get it "working",
but have it break on other machines due to endianess, for example.

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to