Advertisement
If you have a new account but are having problems posting or verifying your account, please email us on hello@boards.ie for help. Thanks :)
Hello all! Please ensure that you are posting a new thread or question in the appropriate forum. The Feedback forum is overwhelmed with questions that are having to be moved elsewhere. If you need help to verify your account contact hello@boards.ie

Quick Random Question I Can't Find Answer For

Options
  • 23-04-2012 9:13pm
    #1
    Registered Users Posts: 1,019 ✭✭✭


    Hi,

    Can't seem to find the answer to a seemingly simple question. I think it's because I don't really know what I'm searching for.

    How would one go about hosting a Java server online? Like say I had a chat room server for example which operated on some arbitrary port which accepted Socket connections from clients through the Internet. Are there hosts that will allow me to run a Java program on their servers? Or am I looking at this in the wrong way?

    I kept coming across Servlets, would you use one of them? I was under the impression Servlets were more for like the backend of pages for a web app.

    Thanks


Comments

  • Closed Accounts Posts: 2,000 ✭✭✭fl4pj4ck


    look up VPS / VDS servers, or look into dedicated servers


  • Moderators, Technology & Internet Moderators Posts: 1,334 Mod ✭✭✭✭croo


    The most popular Servlet Container is Apache's Tomcat. If you google for Tomcat Hosting you will find companies that offer these services ... some in Ireland.

    As fl4pj4ck recommends, renting a whole server - virtual or otherwise - is also an option. A "Java Server" could mean many things but it sounds like you want an application driven by a web front end, so the servlet container might be all you need.


  • Registered Users Posts: 1,019 ✭✭✭carlmango11


    croo wrote: »
    The most popular Servlet Container is Apache's Tomcat. If you google for Tomcat Hosting you will find companies that offer these services ... some in Ireland.

    As fl4pj4ck recommends, renting a whole server - virtual or otherwise - is also an option. A "Java Server" could mean many things but it sounds like you want an application driven by a web front end, so the servlet container might be all you need.

    Ah see this is where I get confused. Is a Servlet just a wrapped up java program running on a server? Like could I have a Servlet constantly running on a server so that it can keep track of connections from clients? I've used Tomcat before but just for websites that respond to HTTP requests or whatever.

    Say for example if I wanted to host a chat room application. Say I've written a java program which waits for Socket connections from clients and manages the messages between them but it needs to be running constantly. How would I host that online? I know how to do it on my home PC but that means my PC has to be online always so I'd rather find a dedicated hosting provider. Sorry if I'm not making sense.

    EDIT: Just found this on Stack Overlow: "Servlets are very specifically an HTTP standard. If you don't want HTTP, you shouldn't use servlets - just write a custom client/server application, as Helen suggets."

    As I said I know how to write the client/server apps just not how/where to host them? Thanks


  • Moderators, Technology & Internet Moderators Posts: 1,334 Mod ✭✭✭✭croo


    Well as I said...
    A "Java Server" could mean many things but it sounds like you
    want an application driven by a web front end

    I was thinking of a web based chat .. but now it seems that was not a good assumption. Of course, the servlet can do a lot more than just generating the HTML pages - and usually that might be accomplished via JSP though you can have the servlet do it too. Ultimately, the essence of a servlet is simply that it's a java class that accepts a HTTP request and returns a HTTP Response. But it can & in my experience does call other non-servlet java classes.

    If the app were web based - or you wrote your client to communicate via the http api (and there are worse things you could do!) then you could use servlets as the main point of contact.

    But if you wanted to develop "a server" of your own making then you could write a whole socket layer API yourself or more likely use something like RMI which would provide the basic infrastructure.
    http://www.eg.bucknell.edu/~cs379/DistributedSystems/rmi_tut.html

    If you follow this route you are effectively writing the server yourself and you then require a machine (connected to the internet) to run it on. So you are back to looking for what fl4pj4ck pointed to ... and its up to you do configure [& secure] it.


  • Moderators, Technology & Internet Moderators Posts: 1,334 Mod ✭✭✭✭croo


    To answer specific questions...
    Is a Servlet just a wrapped up java program running on a server?
    It's a java class that is called by the Servlet Container when a specific url is called. Parameters may be passed into it in the form of a HTTP Request and it can respond in the form of a HTTP response (this are standard defined classes).
    Like could I have a Servlet constantly running on a server so that it can keep track of connections from clients?
    Well the Servlet Container (e.g. Tomcat) would be the application running waiting for connections from clients. Depending on what urls are passed it will call different Servlets and they in turn might call other servlets or java code.
    Say for example if I wanted to host a chat room application. Say I've written a java program which waits for Socket connections from clients and manages the messages between them but it needs to be running constantly.
    So you have written your own server.
    How would I host that online? I know how to do it on my home PC but that means my PC has to be online always so I'd rather find a dedicated hosting provider. Sorry if I'm not making sense.
    Then you need to rent a machine (like your PC at home) that is always on and always online. For that you would rent a VPS/VDS as fl4pj4ck suggested - they tend to be more expensive though than specific hosted servers.


  • Advertisement
  • Registered Users Posts: 1,019 ✭✭✭carlmango11


    Ahh I see I see. So VPS/VDS would be the way forward with the type of client/server app I have written. Not that I'm actually going to any time soon it's just always something that confused me.

    Thanks for all the responses. :pac::pac:


Advertisement