views:

340

answers:

2

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!

+3  A: 

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);

http://www.j2ee.me/j2se/1.4.2/docs/api/java/net/MulticastSocket.html

example from j2ee guide

what you need to do is join the multicast group, then just recv 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.

mog
+3  A: 

You may want to look into VLC's Java bindings. This will give you control of VLC through a Java programming interface. You get all the greatness of VLC from Java! Also, there are several other API bindings and interfaces you can use to play with VLC.

heavyd