a 'nice' way of sending information over sockets is to always include a
package terminator at the end...
the so called End Of Line (or EOL for short).

iirc, thats usually "\015\012"

just my 2 bits,

Jos Boumans

----- Original Message -----
From: "Peter Scott" <[EMAIL PROTECTED]>
To: "Steve Haigh" <[EMAIL PROTECTED]>; <[EMAIL PROTECTED]>
Sent: Tuesday, May 15, 2001 8:18 PM
Subject: Re: Sending UDP messages


> At 03:33 PM 5/15/01 +0100, Steve Haigh wrote:
>
> >I'm currently writing some scripts to send bytes to a UDP server.
> >
> >
> >use IO::Socket;
> >
> >$msg = '0xa';
> >
> >$sock = IO::Socket::INET -> new(PeerAddr => '10.0.0.40',
> >                                 PeerPort => 5525,
> >                                 Proto    => 'udp',
> >                                 Type     => SOCK_DGRAM) || die ("Socket
> > failed : $@");
> >
> >print $sock $msg;
> >
> >
> >The perl seems to work fine apart from one thing.  I'm trying to send a
> >value of 10 ($msg) and what i'm getting at the server is 49.
>
> Not with the code above; you've set $msg to the string '0xa'.
>
> >I'm guessing this is something to do with the ascii value of '1' being
49.
>
> I agree.
>
> >Any ideas how i can send the byte value?
>
> perldoc -f pack.
> --
> Peter Scott
> Pacific Systems Design Technologies
> http://www.perldebugged.com
>
>

Reply via email to