Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsWhite Papers
Discussion GroupsFirst AidDatabasesJavaBeansGUIJava 3DVirtual MachineCORBASecurityToolsGeneral
Java DirectoryOpen Source ProjectsSample Book ChaptersUser GroupsWeb Resources
Related Topics
Databases.NETMore Topics ...

Java Forum / General / January 2006

Tip: Looking for answers? Try searching our database.

Streaming over http

Thread view: 
Robert M. Gary - 13 Jan 2006 03:01 GMT
I'm attempting to web enable one of my java applications (for a variety
of reasons, including the https security).

In one case, my client expect to connect to the server long term and
just receive async information as it happens. That doesn't seem to fit
the http model. but I know its been done. Do you just do an HTTP_GET,
then hang, then reissue a new HTTP_GET after each piece of data?
DOesn't that cause a lot of disconnect/reconnects?

-Robert
Thomas Weidenfeller - 13 Jan 2006 12:56 GMT
> I'm attempting to web enable one of my java applications (for a variety
> of reasons, including the https security).
>
> In one case, my client expect to connect to the server long term and
> just receive async information as it happens.

What happens?

> That doesn't seem to fit
> the http model. but I know its been done. Do you just do an HTTP_GET,
> then hang, then reissue a new HTTP_GET after each piece of data?

Now you are mixing the directions. Does the server send notifications,
or does the client send requests?

> DOesn't that cause a lot of disconnect/reconnects?

HTTP is probably not the best protocol for a notification service. It is
a request/response protocol. So let's assume you mean requests with long
periods of inactivity between them.

Protocol-wise you can keep the connection if you use an HTTP
implementation which can do persistent connections. Even in HTTP 1.1
persistent connections are optional, although they are highly
recommended, and typically they are implemented.

But that alone doesn't help. You need to keep the connection alive to
avoid timeouts.

However, if you requests are indeed sporadic, I don't see the need to
keep the connection alive. Why have a connection hanging around and
using some resources if you just once in a while use it?

I really can't remember which HTTP version the standard library does,
and if it does persistent connections. You have to investigate that for
a start.

/Thomas
Signature

The comp.lang.java.gui FAQ:
ftp://ftp.cs.uu.nl/pub/NEWS.ANSWERS/computer-lang/java/gui/faq
http://www.uni-giessen.de/faq/archiv/computer-lang.java.gui.faq/

Robert M. Gary - 13 Jan 2006 17:20 GMT
Are there no examples of http streaming with Java? Is see a lot of
products that advertise streaming video over http. How did those
programmer implement their algorithms in http's traditional
request,response,disconnect structure?

-Robert
Oliver Wong - 13 Jan 2006 18:39 GMT
> Are there no examples of http streaming with Java? Is see a lot of
> products that advertise streaming video over http. How did those
> programmer implement their algorithms in http's traditional
> request,response,disconnect structure?

   I believe this is usually done with two (or more) threads, like a
solution for the producer-consumer problem. A producer connects to a server
via HTTP, makes a request, and starts copying the response into a buffer.
When the consumer feels that enough data has been buffered to ensure smooth
playback, the consumer starts consuming the buffer, and rendering it on
screen.

   - Oliver
Roedy Green - 14 Jan 2006 05:08 GMT
>Are there no examples of http streaming with Java? Is see a lot of
>products that advertise streaming video over http. How did those
>programmer implement their algorithms in http's traditional
>request,response,disconnect structure?

Streaming is best done with UDP so you just discard packets that don't
arrive in time and do the best you can.  So you are not using HTTP.

To do it with HTTP you could just ask for a giant file, and start
sending it. HTTP does not necessarily tell you how big the file is to
start.   The receiver buffers up x seconds before starting the video,
and if it ever outruns the buffer, it just stops and lets the buffer
fill again, so on a slow line in lurches along, put plays full speed
when it can.

Signature

Canadian Mind Products, Roedy Green.
http://mindprod.com Java custom programming, consulting and coaching.

Thomas Weidenfeller - 16 Jan 2006 09:33 GMT
> Are there no examples of http streaming with Java? Is see a lot of
> products that advertise streaming video over http. How did those
> programmer implement their algorithms in http's traditional
> request,response,disconnect structure?

Streaming over HTTP is done in may different ways. Often the streaming
in the end is not done via HTTP, but just initiated via HTTP. E.g.:

- The server just sends an "endless" file in its response, with a
corresponding media mime type.

- The server sends back some proprietary data with a MIME type which is
actually associated with some other application. The browser hands the
data over to that other application, e.g. some media player. That other
application interprets the data as some information on how to access a
stream, and does so.

- The server sends back some standardized contend description, e.g.
SMIL. The browser hands the data over to some application which can deal
with it.

- The server sends back some HTML which has an embedded player object
definition. The browser starts the player with the parameters provided
in the HTML (one being the actual streaming source) and the player
accesses that source.

There are probably some more techniques.

/Thomas
Signature

The comp.lang.java.gui FAQ:
ftp://ftp.cs.uu.nl/pub/NEWS.ANSWERS/computer-lang/java/gui/faq
http://www.uni-giessen.de/faq/archiv/computer-lang.java.gui.faq/

Haider Albassam - 17 Jan 2006 12:59 GMT
I think it should be something like AJAX so try to see how does it
work.


Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2009 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.