[networking] Connecting a Client to a Server through an Applet in JME3

So I have a client/server architecture where I have a seperated server with outside clients which connect in. Within JMP I can connect multiple clients to the server and have them talk. When compiled into .exe form, I can have the clients connected to my server running in JMP while clients may be on my computer or through my neighbors internet. So without a shadow of a doubt my server is working.

Now, when I took this a step further and tried to have my client connect while distributed in an Applet and ran through Firefox, it seems that when the applet attempts to execute

[java]player_client = new Client(" my ip address ", 9100, 9200);


that the Applet freezes and does not continue to progress. This happens while the applet is supposedly loading resources, but when I comment out those lines the applet loads fine.

So, what is the difference between my Applet and my distributed .exe file? I am assuming it may have to do with securities on the browser or something?

Any help would be really cool. Thanks!

I think it has to do with the way you are trying to access your resources. I’m not an expert on applets but I remember reading somewhere that if you are going to load assets from an applet you need to use the URL method of loading assets in your code. I’m positive they have a few examples on the site here that does that.

Edit: Sorry I misread your post :slight_smile:

as far as my assets, as in textures and models go, they load just fine. Simply that client connection is messing up. Is that considered an asset though?

Applets are only allowed to communicate to the server they are loaded from. Its a security thing.

oh. so my applet could never connect to some external server?

Shoot, there goes my idea… :confused:

I guess it will just have to be .exe deployable.

If anyone has any ideas of how I could make this applet thing work let me know. I doubt my web host would let me launch a server from my domain (if thats even possible?)

A signed WebStart app shoud allow you to do anything.

Just host the applet on that external server, you don’t even need to have an advanced HTTP server there. Just use Java’s minimal HTTP server, that will just serve the code for the applet. You can even use different ports if your host blocks port 80.