#!/usr/bin/perl #Sends an SSDP query to the Rio Audio Manager Server (windows server) with the goal of getting the current URL #to the server app. use Socket; #My Linux server's MAC address $MAC = "00:E0:29:24:87:8D"; #The string we send to the Windows server $MSG = "upnp:uuid:1D274DB0-F053-11d3-BF72-0050DA689B2F\n$MAC\n"; #IP of the Windows server $HOSTIP = "10.0.0.25"; #Hostname of the Windows server from /etc/hosts $HOSTNAME = "giganta"; #UDP dest port number $PORTNO = "21075"; $MAXLEN=1500; socket(SOCKET, PF_INET, SOCK_DGRAM, getprotobyname("udp")) or die "socket: $!"; $ipaddr = inet_aton($HOSTNAME); $portaddr = sockaddr_in($PORTNO, $ipaddr); print "Sending $MSG\n"; send(SOCKET, $MSG, 0, $portaddr) == length($MSG) or die "cannot send to $HOSTNAME($PORTNO): $!"; $portaddr = recv(SOCKET, $MSG, $MAXLEN, 0) or die "recv: $!"; ($portno, $ipaddr) = sockaddr_in($portaddr); $host = gethostbyaddr($ipaddr, AF_INET); #print "$host($portno) said $MSG\n"; $MSG =~ s/\/descriptor.xml//; print "URL is $MSG\n";