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!
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
Joined: Nov 22, 2008
...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