Could you explain in bit detail how can a desktop app poll servlet app ?
You simply make a request to the servlet at a certain interval. Are you unfamiliar with timers in Java or how to talk to a servlet?
Socket programming helps us achive client - server. . .
But here I require peer - peer communication
You are drawing a distinction where none exists. It is not uncommon to have
network peers communicate using sockets. Contacting a servlet via URL uses sockets. The difference between the two is the protocol.
You need to take a look at your requirements. Does your desktop app need instant updates from the web app? Polling will not do. Updates every few minutes? Polling may make sense. If you need the web app to send instant updates, as Ulf indicated, your web app will need to know how to contact it. It can do so directly (the desktop app listens on a socket and the web app contacts it via custom protocol) or you use some intermediary like
Java Message Service to handle the details of transmission.