Can servlets do sockets?

M

Mark McKay

I have a situation where I'd like to have a thick client (either an
applet or a webstart app) connect to a Java program on my server and
start a conversation where they'd be passing XML messages back and
forth. While I could implement this as a stand alone server using
classical sockets, I was wondering if there would be any way to
leverage servlet technology to help me here. I'd prefer sending my
XML along the HTTP to avoid firewall issues. However, as far as I can
tell servlets are respond to one request only, and cannot spawn new
processes.

Is there a way to get a servlet to act like a stand alone server
program?

Mark McKay
 
M

Miguel De Anda

Mark McKay said:
I have a situation where I'd like to have a thick client (either an
applet or a webstart app) connect to a Java program on my server and
start a conversation where they'd be passing XML messages back and
forth. While I could implement this as a stand alone server using
classical sockets, I was wondering if there would be any way to
leverage servlet technology to help me here. I'd prefer sending my
XML along the HTTP to avoid firewall issues. However, as far as I can
tell servlets are respond to one request only, and cannot spawn new
processes.

Is there a way to get a servlet to act like a stand alone server
program?

Mark McKay

Well you can't have two "servers" serving on the same http port so you can't
have a socket listening on port 80/8080. Can't the same servlet be run by 2
threads for 2 different clients? I don't see/understand the problem with
just sending the request as a querystring/form post.
 
W

William Brogden

Mark McKay said:
I have a situation where I'd like to have a thick client (either an
applet or a webstart app) connect to a Java program on my server and
start a conversation where they'd be passing XML messages back and
forth. While I could implement this as a stand alone server using
classical sockets, I was wondering if there would be any way to
leverage servlet technology to help me here. I'd prefer sending my
XML along the HTTP to avoid firewall issues. However, as far as I can
tell servlets are respond to one request only, and cannot spawn new
processes.

Where in the world did you get that idea?
Servlets can start new process Threads, run exec() processes, etc.
You do have to change your mind-set somewhat - a servlet needs
a request to act on.

Perhaps you are talking about a Web Service with SOAP?

WBB
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,764
Messages
2,569,567
Members
45,041
Latest member
RomeoFarnh

Latest Threads

Top