• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Can a servlet listen to something else than http port.. and talk other protocols

 
Ranch Hand
Posts: 18944
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi there,
a very greenhorn question:
Can I design/code an servlet, that - once it's loaded -- listens to a different http port (e.g 25/SMTP or pserver and talk in that protocol? Could someone point to sample code?
THX!
 
Author and all-around good cowpoke
Posts: 13078
6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
A servlet can do just about anything any other class can do - that does not mean it is a good idea. The port and protocol on which your servlet sees requests and responses is fixed by the servlet engine.
You would get better results and not get tangled up in problems of Threading, etc. if you created a separate class (possibly a separate application) to do work on other ports and protocols and have a servlet that can talk to that other class when needed.
Bill
 
Anonymous
Ranch Hand
Posts: 18944
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

...created a separate class (possibly a separate application) to do work on other ports and protocols and have a servlet that can talk to that other class when needed...
Bill


Thx Bill for the answer. Did I get it right:
- I create a standalone Java app that handles my port xyz and then talks to the servlet or the servlet talks to it. For the later a subscriber pattern seems appropriate?
To twist the question a bit: If the servlet can listen on port 80 (or 443), but the "talk" coming in is not http but the protocol/syntax used by a CVS client. Would that be a feasible use for an servlet?
Thx
 
Don't get me started about those stupid light bulbs.
reply
    Bookmark Topic Watch Topic
  • New Topic