sockets and tomcat

I have 2 connect between 2 is web server connectd to the net and the other is a standalone m/c
 with java.

1. what is the best way to connect between these 2 comps. most the main ports like 80, 21 are closed on the 2nd m/c

2. we have a socket pgm that connects to each other, This works fine if i start it seperatly as server progranm.
I tried writing an init servlet to start the pgm but it does not start my socket listner, i need to start it as a seperate pgm

Thx for your help.
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

>>but it does not start my socket listner

That may be a security-related matter. What errors do you get?
applekannaAuthor Commented:
I do not get any errors.. just my socket (server) program does not start and the client is not able to connect to it.


hope this help
applekannaAuthor Commented:
oops ...sorry was trying to answer a question in EE :)
JavaScript Best Practices

Save hours in development time and avoid common mistakes by learning the best practices to use for JavaScript.

applekannaAuthor Commented:
but anyway here is my response.

I do not get any errors.. just my socket (server) program does not start and the client is not able to connect to it. at the client side. But if I start my  program seperately I do not get this error, though I get some other errors becoz of my code.

what do u think is the best way to connect these 2 computers.

Mick BarryJava DeveloperCommented:
What error r u getting on the server side?
What ports are available to you on each machines?
Can you show your code where you're loading it too?
applekannaAuthor Commented:
//my init servlet

public class SocketInitServlet extends HttpServlet implements SingleThreadModel {
  private static final String CONTENT_TYPE = "text/html";
  //Initialize global variables
  public void init() throws ServletException {
    //start the RRSqueryListner
    queryListener listen = new queryListener(); // the init method starts the listner
    System.out.print("Called the RRS constructor for listeining on a socket");

  //Process the HTTP Get request

  //Clean up resources
  public void destroy() {
Have you checked the logs for errors?
Mick BarryJava DeveloperCommented:
And do you get an error?

Have you set your servlet to load on startup in web.xml?

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Mick BarryJava DeveloperCommented:
in your servlet definition:

applekannaAuthor Commented:
Thx for you help all

objects you are right....
i need to have the web.xml entry.

I was under the impresssion that writing anything in the servelt init() method would be called when the server is started.
So is load on startup necessary to initialize the objects in the init method
>>So is load on startup necessary to initialize the objects in the init method

Yes, if they're not loaded by any other cause, such as a request from a page
>>if they're not loaded

the servlets, that is
Mick BarryJava DeveloperCommented:
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Java EE

From novice to tech pro — start learning today.