Socket connection -Applet Servet Comm thru Java Web server


DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

Results 1 to 2 of 2

Thread: Socket connection -Applet Servet Comm thru Java Web server

  1. #1
    anand Guest

    Socket connection -Applet Servet Comm thru Java Web server


    I have created a thread at a servlet oaded on java web server to accept
    socket connection from applets(which try to socket connect) at a specified
    port no..This non http communication is not accepted and serviced .i am
    getting connection refused connectException at applet side?
    thanks in advance
    anand

  2. #2
    Daniel Strecker (icq#: 54120485) Guest

    Re: Socket connection -Applet Servet Comm thru Java Web server


    "anand" <anandakrishnani@rediffmail.com> wrote:
    >
    >I have created a thread at a servlet oaded on java web server to accept
    >socket connection from applets(which try to socket connect) at a specified
    >port no..This non http communication is not accepted and serviced .i am
    >getting connection refused connectException at applet side?
    >thanks in advance
    >anand


    i thought that servlets are only running when requested by a client,
    like CGI scripts or similar. (I assume so, but I'm not sure.)

    So your port will only be listened to by the servlet, if the servlet was
    requested in an http-request earlier and is still running.

    You can start a http request within your applet by creating an new
    instance of java.io.URL and connect it via URL.getInputStream().
    And afterwards, you can connect to the port.

    You also try to ensure that the port is open by telnetting to it or
    using having your webbrowser trying to load http://hostnameortnum/


    good luck,
    Daniel Strecker

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center
 
 
FAQ
Latest Articles
Java
.NET
XML
Database
Enterprise
Questions? Contact us.
C++
Web Development
Wireless
Latest Tips
Open Source


   Development Centers

   -- Android Development Center
   -- Cloud Development Project Center
   -- HTML5 Development Center
   -- Windows Mobile Development Center