Results 1 to 3 of 3
  1. #1
    garciaa is offline Member
    Join Date
    Dec 2010
    Posts
    2
    Rep Power
    0

    Default Applets and Servers... Servlets?

    I'm wondering why my game isnt working, hoping someone can explain.

    I wrote a CheckerClient applet and a CheckerServer application

    the client applet connects to the server app on a port 5000 and starts communication via data output and input steams. Client #1 simply sends the server the location the piece moved from and to (4 integers: fromX, fromY, toX, toY) and the server passes that information to client #2.

    This works perfectly fine as long as i used my local machine as the server (127.0.0.1) but once i tried uploading to an actual server, the game wont run, it displays, but it wont actually work, it appears as if no connection was made.

    When i look at the server application i can see that the server is still waiting for a connection.

    After doing some research i saw that this is by design, that applets are not meant to connect over a nerwork, that i should look into servlets.

    but before i run off and study servlets which is a completely new concept to me, and seem, at first glance, to be very different from applets, i wanted to make sure that there was no way to have an applet talk to another applet on another machine.

    This was a project for school (which ended at getting it to work locally), but i want to host it on my webpage.

    i can provide some code if need be, but i dont think the problem is the code since it does work perfectly locally.

    please someone enlighten me, or point me in the right direction.

    Thanks,
    Alex G.

  2. #2
    travishein's Avatar
    travishein is offline Senior Member
    Join Date
    Sep 2009
    Location
    Canada
    Posts
    684
    Rep Power
    5

    Default

    yes, applets can only communicate with the server from where they were originated from.
    if you changed the applet to make it so it used the server as a proxy to do the connections to the other server that would work, but that is likely a lot of work and changes to the game applet messaging model.

    another idea, would it be possible to change the applet into a stand alone java desktop application. then could use something like java webstart with a .jnlp file to have the code downloaded as needed fromyour server but the application runs as a desktop application, and then should be able to communicate with any other server as needed. I think converting applets to frame applications would be less work than reworking the networking to use servlets anyway..

  3. #3
    garciaa is offline Member
    Join Date
    Dec 2010
    Posts
    2
    Rep Power
    0

    Default

    Thank you, i will explore that option, since im already familiar with turning applets into applications and vise versa.

    Thanks,
    Alex G.

Similar Threads

  1. Javamail and different servers
    By Clockwork in forum Java Servlet
    Replies: 3
    Last Post: 07-12-2010, 07:57 PM
  2. how to connect two servers??
    By init in forum Networking
    Replies: 8
    Last Post: 03-28-2010, 06:59 PM
  3. Copy files between servers
    By mcoto800 in forum Java Servlet
    Replies: 1
    Last Post: 02-05-2010, 01:05 AM
  4. subforum for servers
    By tushar88 in forum Suggestions & Feedback
    Replies: 3
    Last Post: 03-10-2009, 02:25 AM
  5. Looking for servers on ports
    By Java Tip in forum Java Tip
    Replies: 0
    Last Post: 12-13-2007, 09:28 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •