Solved

sockets and tomcat

Posted on 2003-11-26
14
371 Views
Last Modified: 2013-11-24
I have 2 connect between 2 computers.one 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.
0
Comment
Question by:applekanna
  • 5
  • 5
  • 4
14 Comments
 
LVL 86

Expert Comment

by:CEHJ
ID: 9828226
>>but it does not start my socket listner

That may be a security-related matter. What errors do you get?
0
 
LVL 3

Author Comment

by:applekanna
ID: 9828268
I do not get any errors.. just my socket (server) program does not start and the client is not able to connect to it.
expereince
http://www.javaranch.com/maha/index.html

SCWCD
http://www.whizlabs.com/articles/scwcd-article.html
SCJP
http://www-106.ibm.com/developerworks/java/library/j-scjp/
http://www.javaprepare.com/books/books.html


hope this help
Cheers!
0
 
LVL 3

Author Comment

by:applekanna
ID: 9828278
oops ...sorry was trying to answer a question in EE :)
0
Master Your Team's Linux and Cloud Stack!

The average business loses $13.5M per year to ineffective training (per 1,000 employees). Keep ahead of the competition and combine in-person quality with online cost and flexibility by training with Linux Academy.

 
LVL 3

Author Comment

by:applekanna
ID: 9828295
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.

java.net.ConnectException 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.


0
 
LVL 92

Expert Comment

by:objects
ID: 9828470
What error r u getting on the server side?
What ports are available to you on each machines?
0
 
LVL 86

Expert Comment

by:CEHJ
ID: 9828483
Can you show your code where you're loading it too?
0
 
LVL 3

Author Comment

by:applekanna
ID: 9828798
//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() {
  }
}
0
 
LVL 86

Assisted Solution

by:CEHJ
CEHJ earned 50 total points
ID: 9828836
Have you checked the logs for errors?
0
 
LVL 92

Accepted Solution

by:
objects earned 200 total points
ID: 9828837
And do you get an error?

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

Expert Comment

by:objects
ID: 9828843
in your servlet definition:

<load-on-startup>1</load-on-startup>
0
 
LVL 3

Author Comment

by:applekanna
ID: 9829072
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
0
 
LVL 86

Expert Comment

by:CEHJ
ID: 9829086
>>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
0
 
LVL 86

Expert Comment

by:CEHJ
ID: 9829092
>>if they're not loaded

the servlets, that is
0
 
LVL 92

Expert Comment

by:objects
ID: 9829093
0

Featured Post

3 Use Cases for Connected Systems

Our Dev teams are like yours. They’re continually cranking out code for new features/bugs fixes, testing, deploying, testing some more, responding to production monitoring events and more. It’s complex. So, we thought you’d like to see what’s working for us.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
servlet  URL Rewriting 1 38
tomcat not starting 6 47
hibernate example issues from command prompt 10 42
jsp login check 12 32
Go is an acronym of golang, is a programming language developed Google in 2007. Go is a new language that is mostly in the C family, with significant input from Pascal/Modula/Oberon family. Hence Go arisen as low-level language with fast compilation…
Introduction This article is the second of three articles that explain why and how the Experts Exchange QA Team does test automation for our web site. This article covers the basic installation and configuration of the test automation tools used by…
Viewers will learn one way to get user input in Java. Introduce the Scanner object: Declare the variable that stores the user input: An example prompting the user for input: Methods you need to invoke in order to properly get  user input:
This tutorial covers a step-by-step guide to install VisualVM launcher in eclipse.

832 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question