• Post Reply Bookmark Topic Watch Topic
  • New Topic

Running a Java server through a Web Host

 
Astor Bundy
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
My goal is to run a Java server on a website. The server must have the ability to send and receive UDP packets to Java clients over the internet.

For example, a chat client connects to the server by using an IP address and port (port 80 for example). The user of this client can send messages (packets) to the server and the server distributes these messages (packets) to all the other clients that are connected to the server.

The server would need to import the following for networking:



I am hoping to be able to run the server through a Java applet or even by starting it with PHP code.

Certain permissions would likely be required. For example, a free web-hosting service such as on web page: http://chatserver.comli.com/ may not be able to run the server. The SSH ports are closed here, but there are open ports that could probably be used.

Another goal would be for the server to be able to print to a console on that same web page using "System.out.println".

The URL of the web page along with the port of the server would need to be used to connect to the server. Other websites are hosted under the same IP address.

Is it possible for these goals to be accomplished? If anyone could help provide insight or if you have any ideas, please share.
 
Joe Ess
Bartender
Posts: 9362
11
Linux Mac OS X Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Welcome to the JavaRanch. We ask that you let us know if you post your question on other websites. That way if it is answered there, our community doesn't duplicate the other site's effort.

Astor Bundy wrote:
I am hoping to be able to run the server through a Java applet or even by starting it with PHP code.


First, Java applets run on the client, in the browser. If you want to run something on the web server, an applet would not be a good solution.
Second, as you mention, a free web host will not do. You will need something that gives you shell access, permission to run arbitrary applications and open arbitrary ports. If you have more than one computer (or even virtual machines), you can simulate this traffic locally before attempting to conquer the web server issue.

Another goal would be for the server to be able to print to a console on that same web page using "System.out.println".


You should probably look at using a web applet on the client end. The server would send the message and the client would print it out. You'll need to have some sort of GUI so your applet can print things out.
 
Chris Hurst
Ranch Hand
Posts: 443
3
C++ Eclipse IDE Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I'd just use websockets for the chat app much simpler. You definitely don't want applets anywhere involved.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!