Force UTF-8 when sending WS-Discovery Probe

This commit is contained in:
Jan M. Hochstein 2016-04-09 17:07:11 +02:00
parent 124d781699
commit 1558353672
1 changed files with 5 additions and 2 deletions

View File

@ -61,16 +61,19 @@ sub _notify_response
}
sub send_multi() {
my ($self, $address, $port, $data) = @_;
my ($self, $address, $port, $utf8_string) = @_;
my $destination = $address . ':' . $port;
my $socket = IO::Socket::Multicast->new(PROTO => 'udp',
LocalPort=>$port, PeerAddr=>$destination, ReuseAddr=>1)
or die 'Cannot open multicast socket to ' . ${address} . ':' . ${port};
my $bytes = $utf8_string;
utf8::encode($bytes);
$socket->mcast_ttl(1);
$socket->send($data);
$socket->send($bytes);
}
sub receive_multi() {