Java – How to access a IPTV server programatically

iptvjavanetworkingudp

My University is currently running an IPTV trial. To access the service, you are asked to install VLC Media Player, and run the files, downloaded from the University's intranet, each representing a channel, through it.

The files are of the format:

#EXTM3U
#EXTINF:0,ITV2
udp://@238.255.0.6:2001

Which I recognise as an M3U playlist file. Fortunately, the file species the IP address of the server hosting the service, the port to access it through, and the protocol, in this case the UDP.

My question is, how could I get access to the service programatically? Is there a specific handshake a client does with the server? Seeing as it's accessible so simply via VLC Media Player, surely accessing the data will be trivial as there is no proprietary protocol used?

I'm not too clued up on accessing the Internet programatically; I know in Java a Port can be constructed which models the UDP. I would appreciate the answers in Java, but any similar language is more than enough.

Thanks!

Best Solution

Their is a special handshake at the switch level, its telling the switch you are part of the multicast group so that you will also receive the packets.

Bellow is an example of registering and receiving on a UDP socket in java:

 // join a Multicast group and send the group salutations

 InetAddress group = InetAddress.getByName("228.5.6.7");
 MulticastSocket s = new MulticastSocket(6789);
 s.joinGroup(group);
 // get their responses!
 byte[] buf = new byte[1000];
 DatagramPacket recv = new DatagramPacket(buf, buf.length);
 s.receive(recv);
 ...
 // OK, I'm done talking - leave the group...
 s.leaveGroup(group);

Example from j2ee guide.

What you need to do is join the multicast group, then just receive the packets and write them to a file, then I would assume the MPEG2, MPEG4 or however the stream is sent will be a file on your machine that should be playable through another program.