- Computers & Software»
- Computer How-Tos & Tutorials
Data Streaming Over The Internet
HTML5 Data Streaming
(c) 2013 kevin languedoc (klanguedoc)
Data streaming over the Internet isn't so much a program as it is networking technology and APIs. There are several ways to accomplish this.
If you are using HTML5 you could use Cross Document Messaging or ChannelMessaging. Cross Document Messaging is a one way communication between two different domains. ChannelMessaging is a two way asynchronous messaging between two browser windows that uses ports to attach to the window. However these also have protection in place so that these processes only run in their own sandboxes.
SSE and Web Workers
Also in HTML5 is SSE or Server-Sent-Events or WebWorkers. These both allow for asynchronous communication between a client and host computer. Both of these could be used to initiate communication between computers using peer to peer communication. You could also use TCP/IP or Telnet. Actually Telnet can be use to control remote servers and Telnet uses the underlying TCP/IP protocol which in turn uses an IP address.
HTML5 Video and Audio
These elements media from one computer (server) or host to the client (browser). You could use the video element or audio in HTML5 or the Object or Embed elements in HTML4 to stream AV media files from one computer to another. The syntax is very simple:
<video width="520" height="320" controls> <source src="movie.mp4" type="video/mp4"> </video>
<audio controls> <source src="audio.mp3" type="audio/mpeg"> Your browser does not support the audio element. </audio>
HTML Object with QuickTime
<object width="520" height="460" classid="clsid:02BF25D5-8C17-4B23-BC80-D3488ABDDC6B" codebase="http://www.apple.com/qtactivex/qtplugin.cab"> <param name="src" value="audio.wav"> <param name="controller" value="true"> </object>
HTML Object with Flash
<object width="600" height="540" classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://fpdownload.macromedia.com/ pub/shockwave/cabs/flash/swflash.cab#version=8,0,0,0"> <param name="SRC" value="file.swf"> <embed src="file.swf" width="320" height="140"> </embed> </object>
HTML Object with Windows Media Player
<object width="100%" height="100%" type="video/x-ms-asf" url="sound.wmv" data="sound.wmv" classid="CLSID:6BF52A52-394A-11d3-B153-00C04F79FAA6"> <param name="url" value="sound.wmv"> <param name="filename" value="sound.wmv"> <param name="autostart" value="1"> <param name="uiMode" value="full"> <param name="autosize" value="1"> <param name="playcount" value="1"> <embed type="application/x-mplayer2" src="sound.wmv" width="100%" height="100%" autostart="true" showcontrols="true" pluginspage="http://www.microsoft.com/Windows/MediaPlayer/"></embed> </object>
HTML Embed Element
<embed height="350" width="200" src="media.mp3">
Data streaming can be accomplished using a variety of APIs available in most programming languages like Java, Objective-C or C# or yet again PHP. You write a web service which could send and receive data streams. In Java you could write a servlet that uses the HTTPRequest and HTTPResponse methods. In C# you could also create HTTPhandler (ashx file) to receive and send HTTP responses.
RTRP, RTTCP, RTP
Several protocols other than the ones mentioned above can be used for data streaming. For instance for real time media streaming you could write a program that uses the RTSP (Real Time Streaming Protocol) or the Real Transport Protocol (RTP) and finally the Real Time Transport Control Protocol (RTTCP) which was designed for streaming data (media) over networks in real time.
These can be implemented using for instance Windows Media Player and the embed element or even the audio and video elements in HTML5. In the source, you specify the rstp protocol followed by the URI of the media file.
On the Java side, the rstp protocol can be implemented in a program like a servlet using the Java Media Framework. The same can be said for the .Net platform (C# or VB.net) you could the the Microsoft Media Foundation which provides a rich set of APIs to media streaming. In C/C++ or Objective-C you could use the Live555 library or the Mac OSX or iOS SDK Media Framework and the NSURLConnection or NSHTTPRequest classes.
You could also use the Datagram protocols which sends data in small packets. If you wanted to implement this protocol in a PHP program, you could use the Sockets API or in python you could write a program that uses sockets. In Objective-C, the SDK has a rich set the APIs for any kind of network connectivity. Again you could use sockets and socket streams for Datagrams transfers.
Telnet is another Inter-networking protocol. For instance you could enable the Telnet client in Windows by accessing the Windows features trough the control panel and "Turn On or Off Windows Features". Select the Telnet client. Then from the "Run" prompt type services.msc to bring up the Windows services. Locate the Telnet service, right click on it and click on "Start"
Once the service is finish loading, open a commend prompt by typing in the "cmd" command un the "run" prompt under the Start button.
Type telnet followed by the IP address like: telnet 000.000.000.000. To get the IP of a web site, simply write ping and the domain name like ping www.hubpages.com. Of course this is all theoretical because most web sites are protected by firewalls and proxy servers (its not like in the movies). However you could with the proper permissions to access a remote computer and then use a software to stream your data.
So in essence, there are many ways to stream data from one computer to another if you have the proper permissions or if the system is configured to allow such as thing over the Internet.