Can servlets do sockets?

Discussion in 'Java' started by Mark McKay, Aug 20, 2003.

  1. Mark McKay

    Mark McKay Guest

    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
    Mark McKay, Aug 20, 2003
    #1
    1. Advertising

  2. "Mark McKay" <> wrote in message
    news:...
    > 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.
    Miguel De Anda, Aug 20, 2003
    #2
    1. Advertising

  3. "Mark McKay" <> wrote in message
    news:...
    > 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
    William Brogden, Aug 21, 2003
    #3
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Replies:
    1
    Views:
    704
    Wendy S
    Jan 7, 2005
  2. Bit Byte

    Can I use servlets and ASP.Net 2.0 ?

    Bit Byte, Feb 13, 2007, in forum: ASP .Net
    Replies:
    0
    Views:
    306
    Bit Byte
    Feb 13, 2007
  3. Bit Byte

    Can I use servlets WITH ASP.Net 2.0 ?

    Bit Byte, Feb 13, 2007, in forum: ASP .Net
    Replies:
    3
    Views:
    327
    bruce barker
    Feb 13, 2007
  4. Covington Bradshaw

    Servlets / How can we discard a request?

    Covington Bradshaw, Mar 10, 2007, in forum: Java
    Replies:
    7
    Views:
    906
    Chris Uppal
    Mar 12, 2007
  5. jmDesktop
    Replies:
    4
    Views:
    1,104
    Arne Vajhøj
    May 26, 2008
Loading...

Share This Page