in reply to Re: Re: UDP socket questions
in thread UDP socket questions

For the first question, you have to specify LocalAddr, that should resolve your problem. For example:
use IO::Socket::INET; $sock_r = IO::Socket::INET->new(Proto => "udp", LocalAddr => "127.1") or die "can't connect socket to port: $!"; $host_port = $sock_r->sockport; print "Listening on host_port $host_port\n";


For you second part, just as jasonk said UDP does not understand what ASCII is, or what binary is, it is just a stream of bytes. Encoding is controlled by your script. Absolutely nothing to with UDP, and UDP absolutely does not care that.

As for syntax, you write binary data to socket in the same way you swrite ascii data to it. The socket does not know, and does not care what you are sending.

Replies are listed 'Best First'.
Re: Re: Re: Re: UDP socket questions
by sbrandt (Initiate) on Mar 13, 2003 at 21:40 UTC
    Thank you All so much!!

    Adding "LocalAddr" was all I needed and now $sock_r->sockport returns the listening port.

    Sending $hex hi thru my write socket is exactly what I need!

    # results in "4567" in datagram trace - WINNER!! my $hex_hi = pack("H*", "4567");