Results 1 to 3 of 3
Thread: Applets and Servers... Servlets?
- 12-17-2010, 11:16 PM #1
Member
- Join Date
- Dec 2010
- Posts
- 2
- Rep Power
- 0
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.
- 12-18-2010, 03:02 AM #2
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..
- 12-19-2010, 09:47 AM #3
Member
- Join Date
- Dec 2010
- Posts
- 2
- Rep Power
- 0
Similar Threads
-
Javamail and different servers
By Clockwork in forum Java ServletReplies: 3Last Post: 07-12-2010, 07:57 PM -
how to connect two servers??
By init in forum NetworkingReplies: 8Last Post: 03-28-2010, 06:59 PM -
Copy files between servers
By mcoto800 in forum Java ServletReplies: 1Last Post: 02-05-2010, 01:05 AM -
subforum for servers
By tushar88 in forum Suggestions & FeedbackReplies: 3Last Post: 03-10-2009, 02:25 AM -
Looking for servers on ports
By Java Tip in forum Java TipReplies: 0Last Post: 12-13-2007, 09:28 AM


LinkBack URL
About LinkBacks
Reply With Quote
Bookmarks