my dog learned polymorphism*
The moose likes Sockets and Internet Protocols and the fly likes What is server side pushing Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Java » Sockets and Internet Protocols
Bookmark "What is server side pushing" Watch "What is server side pushing" New topic
Author

What is server side pushing

Satish Kota
Ranch Hand

Joined: Feb 08, 2006
Posts: 88
Hi Ranchers,
I came across the term in of the articles saying server side pushing. I tried googling to understand what this technique is but in vain. Can some one please explain what server side puching exactly means?


SCJP 5.0 77%
Jeroen T Wenting
Ranch Hand

Joined: Apr 21, 2006
Posts: 1847
Normally the client requests data from the server and the server will send data ONLY after a request.
With push data, the client subscribes to a service (or channel as it's called) and the server will send data over that channel without being asked again until either it detects the client is down (via network errors over the channel) or the client unsubscribes explicitly.

That's a well behaved push service. A poorly behaved push service is a DOS attack where a server sends data without ever being asked, either in an attempt to break into a client system or to prevent it from using its network connection.


42
Rahul Bhattacharjee
Ranch Hand

Joined: Nov 29, 2005
Posts: 2308
Originally posted by Jeroen T Wenting:
Normally the client requests data from the server and the server will send data ONLY after a request.
With push data, the client subscribes to a service (or channel as it's called) and the server will send data over that channel without being asked again until either it detects the client is down (via network errors over the channel) or the client unsubscribes explicitly.

That's a well behaved push service. A poorly behaved push service is a DOS attack where a server sends data without ever being asked, either in an attempt to break into a client system or to prevent it from using its network connection.


DOS is something in which client makes requests and a real lot of requests , to jam all the worker threads at the service / server.

For me , server push is nothing but server sending data to client on request.
I cannot think of any program in which my client connects to a server and waits for response from server all the time.
RSS readers are the closest thing that I can think of , but they also have to make request to get the response.


Rahul Bhattacharjee
LinkedIn - Blog
Ben Souther
Sheriff

Joined: Dec 11, 2004
Posts: 13410

Originally posted by Rahul Bhattacharjee:

I cannot think of any program in which my client connects to a server and waits for response from server all the time.


AIM and Yahoo Instant messager are two examples of applications that connect to a server and wait for the server to push messages down to them.


Java API J2EE API Servlet Spec JSP Spec How to ask a question... Simple Servlet Examples jsonf
Rahul Bhattacharjee
Ranch Hand

Joined: Nov 29, 2005
Posts: 2308
Originally posted by Ben Souther:


AIM and Yahoo Instant messager are two examples of applications that connect to a server and wait for the server to push messages down to them.


Yes , but I guess here also there is a thread in the client side which periodically sends request to the respective server for updates and gets response.
Ben Souther
Sheriff

Joined: Dec 11, 2004
Posts: 13410

Originally posted by Rahul Bhattacharjee:


Yes , but I guess here also there is a thread in the client side which periodically sends request to the respective server for updates and gets response.


No.
Unlike with HTTP (stateless) AIM and YIM operate over a stateful protocol. They maintain a constant connection with the server and wait for data to be pushed to them.

To implement something similar with Servlets (or any HTTP technology) you would need to poll periodically because servlets don't maintain a constant connection with their clients (browsers usually).

You can see how both technologies work with a packet sniffer such as Ethereal or TCPFlow.
[ December 07, 2006: Message edited by: Ben Souther ]
Rahul Bhattacharjee
Ranch Hand

Joined: Nov 29, 2005
Posts: 2308
Ok.thats great to know.

It means that as soon as the client connects to the server , one port at the client and one at the server is reserved for further communication till the logging off happens.
Ben Souther
Sheriff

Joined: Dec 11, 2004
Posts: 13410

Nothing has to bind to a port on the client machine because the original connection is initiated from there.

I'm going to move this conversation to our "Sockets and Internet Protocols" forum because the conversation doesn't apply to servlets.

Servlets don't push anything.
[ December 07, 2006: Message edited by: Ben Souther ]
Stan James
(instanceof Sidekick)
Ranch Hand

Joined: Jan 29, 2003
Posts: 8791
Our application has an applet in the browser that opens a server socket. It registers its address & port with the app server at logon and de-registers at logoff or session invalidate. The app server can send messages to the applet at any time. It does open-send-close so there are no connections hanging open all day long. And, yes, we are running into some firewall issues.
[ December 07, 2006: Message edited by: Stan James ]

A good question is never answered. It is not a bolt to be tightened into place but a seed to be planted and to bear more seed toward the hope of greening the landscape of the idea. John Ciardi
D Rog
Ranch Hand

Joined: Feb 07, 2004
Posts: 472

I used server side pushing successfully to implement servlet based chat. it works quite good and no polling requiring. However browsers have a tendency to close opened connections after some time, so push channel should be refreshed. I believe some keep-alive settings can change the behavior. You can look in my implementation at:

http://7bee.j2ee.us/chathouse/readme.htm


Retire your iPod and start with HD Android music player Kamerton | Minimal J2EE container is here | Light weight full J2EE stack | and build tool | Co-author of "Windows programming in Turbo Pascal"
Neerav Narielwala
Ranch Hand

Joined: Dec 08, 2006
Posts: 106
The term 'server push' generally means that a server pushes content to the browser client. In reality, a browser doesn't allow this directly. However, it may be emulated in a number of ways.

The client polls the server at a certain interval, say every five minutes. This technique is typically used to update news information. The client does this by reloading a page every so often.
The client uses the 'multipart/x-mixed-replace' content type when sending a response. The content type is expected to send a series of documents one after the other, where each one will replace the previous one. The server might delay between each part, which gives the illusion that the data is being updated after an interval. This technique requires a connection to stay open.
In Mozilla 1.6 and later, server sockets may be used to listen for incoming connections. This technique works similarly to the way a server would listen to connections from a browser and doesn't require a connection to be kept open. However, server sockets may only be used from privileged code.


<a href="http://www.java-tips.org/java-tutorials/tutorials/" target="_blank" rel="nofollow">Java Tutorials</a> | <a href="http://www.planet-java.org" target="_blank" rel="nofollow">Java Weblog</a> | <a href="http://computer-engineering.science-tips.org" target="_blank" rel="nofollow">Computing Articles</a>
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: What is server side pushing
 
Similar Threads
java server and client dotnet
FileNotFoundException in Eclipse when creating a webservice
servlet calls swing application
RMI implementation
Flex Vs J2ee