Welcome to the Java Programming Forums


The professional, friendly Java community. 21,500 members and growing!


The Java Programming Forums are a community of Java programmers from all around the World. Our members have a wide range of skills and they all have one thing in common: A passion to learn and code Java. We invite beginner Java programmers right through to Java professionals to post here and share your knowledge. Become a part of the community, help others, expand your knowledge of Java and enjoy talking with like minded people. Registration is quick and best of all free. We look forward to meeting you.


>> REGISTER NOW TO START POSTING


Members have full access to the forums. Advertisements are removed for registered users.

Results 1 to 8 of 8

Thread: Applet-Server Communication

  1. #1
    Member
    Join Date
    Jun 2011
    Posts
    182
    My Mood
    Where
    Thanks
    15
    Thanked 8 Times in 8 Posts

    Default Applet-Server Communication

    If I understand Applets correctly, I believe it is a reference in the page to the applet file on the server, which is then loaded into the user's internet browser.

    So, what if you want to have the Applet obtain information from the server? If it is operating in the user's browser on the user end, you can't use a local URL reference right?

    Do you need to use a servlet?

    Any help is appreciated. Thanks in advance!


  2. #2
    Super Moderator Norm's Avatar
    Join Date
    May 2010
    Location
    Eastern Florida
    Posts
    25,140
    Thanks
    65
    Thanked 2,720 Times in 2,670 Posts

    Default Re: Applet-Server Communication

    Do you need to use a servlet?
    No, a servlet is not needed. Of course it depends on your application if it needs the servlet. I've used a perl cgi-bin to provide server side services.

  3. #3
    Member
    Join Date
    Jun 2011
    Posts
    182
    My Mood
    Where
    Thanks
    15
    Thanked 8 Times in 8 Posts

    Default Re: Applet-Server Communication

    But, how can you refer directly to a location on the server-side file system if the applet gets loaded into the client's browser?

  4. #4
    Super Moderator Norm's Avatar
    Join Date
    May 2010
    Location
    Eastern Florida
    Posts
    25,140
    Thanks
    65
    Thanked 2,720 Times in 2,670 Posts

    Default Re: Applet-Server Communication

    You don't refer directly to a location on the server side. You ask some code on the server side to do something for you. That could include asking it to read a file on the server or from another server or ...

  5. #5
    Member
    Join Date
    Jun 2011
    Posts
    182
    My Mood
    Where
    Thanks
    15
    Thanked 8 Times in 8 Posts

    Default Re: Applet-Server Communication

    Yeah, but... what I'm trying to ask is how do you access that code?

  6. #6
    Super Moderator Norm's Avatar
    Join Date
    May 2010
    Location
    Eastern Florida
    Posts
    25,140
    Thanks
    65
    Thanked 2,720 Times in 2,670 Posts

    Default Re: Applet-Server Communication

    What protocols and what ports does the server listen on?
    For example
    HTTP on 80 => Use Socket or HTTPURLConnection classes to send a GET/POST request
    FTP on 25 ? => Use Socket with the FTP protocol

  7. #7
    Member
    Join Date
    Jun 2011
    Posts
    182
    My Mood
    Where
    Thanks
    15
    Thanked 8 Times in 8 Posts

    Default Re: Applet-Server Communication

    Quote Originally Posted by Norm View Post
    What protocols and what ports does the server listen on?
    For example
    HTTP on 80 => Use Socket or HTTPURLConnection classes to send a GET/POST request
    FTP on 25 ? => Use Socket with the FTP protocol
    This is theoretical. No plan has been drawn yet for anything.

    I don't know. This isn't an area I'm an expert on. Would you happen to have any suggestions?

    I could see using a HttpUrlConnection to access URLs on the server side perhaps?

  8. #8
    Super Moderator Norm's Avatar
    Join Date
    May 2010
    Location
    Eastern Florida
    Posts
    25,140
    Thanks
    65
    Thanked 2,720 Times in 2,670 Posts

    Default Re: Applet-Server Communication

    I'd use HTTP

Similar Threads

  1. server/client communication problem
    By perl0101 in forum Java Networking
    Replies: 8
    Last Post: May 24th, 2011, 01:58 PM
  2. Replies: 0
    Last Post: January 22nd, 2011, 11:52 AM
  3. client server communication
    By Brt93yoda in forum Java Theory & Questions
    Replies: 4
    Last Post: September 2nd, 2010, 04:49 PM
  4. Site to site communication (applet)
    By sanyi007 in forum Java Theory & Questions
    Replies: 0
    Last Post: May 16th, 2010, 07:19 AM
  5. servlet applet communication
    By prashanthi_asn in forum Java Servlet
    Replies: 0
    Last Post: May 21st, 2009, 12:50 AM