This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan on-line!
See this thread for details.
The moose likes Beginning Java and the fly likes how run this server over internet Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "how run this server over internet" Watch "how run this server over internet" New topic
Author

how run this server over internet

Denis Palencia
Greenhorn

Joined: Jul 11, 2006
Posts: 1
Please help. I want to have my server running on the internet/webhost so people could use it by going through their client program (i don't think it will crash if many go on it because no one knows about it yet) which I will give them and chat and interact. I don't think applets or servlets are necessary just java standalone client program and server.

Hello I am a beginner to java and I am trying to put up a server program on the internet. I figure that I have to put my server on a webhost, run java on it, and run the server program with java interpreter. I dont think that I could run java off servers though because I never heard my host say anything about carrying the java interpreter. When I try to turn on the server by pointing to the CLASS file in the URL of the BROWSER, the browser just asks if I want to download it as a file and doesn't send it to the java interpreter. I have placed my server class files with my html documents. I have a java server and a java client that is not for applets but runs outside browsers.

What do I do? I think I need a computer to run the server program on 24hrs per day / 7days per week. This is my web host awardspace.com.
I also think that my client program can be given to my friends so that we can all access and interact together with the server program.

I got the pair working on my home desktop by running the cmd.exe and writing "java Server" and then opening another cmd.exe for each client "java Client". I opened several clients and shared info but only with myself pretending to be several people/clients.

I have heard that I need to point to a server computer so i put "http://webmaster.awardspace.com" as the ip/name and 4242 as the port all in my client program.
In my server program I just have 4242 as the port in the server socket.

In order to have the server socket listening the server program must be running with the java interpreter right? Or does it start running when client calls? do I have to configure some stuff on my web host? Is the server my desktop or is my web host suitible?

Please help. I want to have my server running on the internet/webhost so people could use it by going through their client program (i don't think it will crash if many go on it because no one knows about it yet) which I will give them and chat and interact. I don't think applets or servlets are necessary just java standalone client program and server.


An applet a day...
Rusty Shackleford
Ranch Hand

Joined: Jan 03, 2006
Posts: 490
Well, if your web host doesn't allow you to run a JVM, you could try compiling the code so it will run natively, or better yet switch hosting companies. If you have the bandwidth and your ISP allows it, you can run your server at home. Although it is not the best idea to use your personal machine for this. An Xbox with linux installed is a cheap solution, but it depends on whether your ISP allows it. Google for hosting companies and java, some only allow Servlets/JSP though.

yes, the server has to be running first, before clients can connect. How you do this depends on your hosting company, probably through a telnet program.

Generally a ServerSocket only needs its port passed to it, but of course clients need both the IP and port.

Only you would know if your server can handle multiple clients, it has to be written to allow it, usually through threads.


"Computer science is no more about computers than astronomy is about telescopes" - Edsger Dijkstra
Stan James
(instanceof Sidekick)
Ranch Hand

Joined: Jan 29, 2003
Posts: 8791
If you're comfortable in Unix, look for a host running Xen or one of the "virtual machine" setups. It's (almost) exactly like having your own server and you can run the JVM and open ports and so on. It all sounds very cool, but way over my head in Unix skills required.


A good question is never answered. It is not a bolt to be tightened into place but a seed to be planted and to bear more seed toward the hope of greening the landscape of the idea. John Ciardi
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: how run this server over internet
 
Similar Threads
FTP Upload
Client Server Chat Network Issue
java.net.Connect Exception: Connection refused java.lang.Null Pointer Exception
Java hs_err-pid2728,log
activate server by client in socket program?