Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Java > Can servlets do sockets?

Reply
Thread Tools

Can servlets do sockets?

 
 
Mark McKay
Guest
Posts: n/a
 
      08-20-2003
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
 
Reply With Quote
 
 
 
 
Miguel De Anda
Guest
Posts: n/a
 
      08-20-2003

"Mark McKay" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed) om...
> 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.


 
Reply With Quote
 
 
 
 
William Brogden
Guest
Posts: n/a
 
      08-21-2003

"Mark McKay" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed) om...
> 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


 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Servlets / How can we discard a request? Covington Bradshaw Java 7 03-12-2007 06:38 PM
Can I use servlets WITH ASP.Net 2.0 ? Bit Byte ASP .Net 3 02-13-2007 06:46 PM
Can I use servlets and ASP.Net 2.0 ? Bit Byte ASP .Net 0 02-13-2007 11:54 AM
Java servlets: Hi All! I want to display xml file in browser using servlets datta.saru Software 0 05-15-2006 03:30 PM
Can JSF chain servlets together (to-view-id) ? javaguy@sbcglobal.net Java 1 01-07-2005 02:15 AM



Advertisments