#
# connect to player
#
if(SOCKNAME =~ m/^\d+$/) {
$socket = IO::Socket::INET->new(Type => SOCK_STREAM, PeerAddr => SOCKHOST, PeerPort => SOCKNAME);
} else {
$socket = IO::Socket::UNIX->new(Type => SOCK_STREAM, Peer => SOCKNAME);
}
This is a pieve of perl code that opens a socket on the localhost at a specified port.
The first part uses INET which I can program in java, the second part uses
some UNIX socket thingy that I'm not familiar with. There is a .sock file that this perl program calls and communicates with.
What I want to know is, how do I write a java program that opens a socket to a file in Linux ? /tmp/jd.sock is the file. I'm guessing this is the method that the perl program uses to communicate with the other perl program.
jd is a mp3player, and you can connect to it and queue up songs and cancel songs etc.
Ok not a very well organised post but you should get the jist and if you could help me that would be great !
Thanks,
Ro.