Solved

Multiple TCP connections from JSP to host application

Posted on 2003-11-10
7
319 Views
Last Modified: 2010-04-01
I have an application that I need to provide web based access to.

The existing application has a Java API that can be used to integrate with it, under the hood it just communicates via ASCII text strings via TCP/IP connections.

I have implemented JSP pages on a Tomcat server that use Beans I have created to call the various methods I require through the API.

My problem is this:

The application will only accept one connection from each TCP host, so using a web server I can only ever have one connection to the application open at any one time. This obviously presents problems when the number of concurrent users increases and performance degrades pretty sharply.

Is there any way to set-up the application (Tomcat / JSP / Bean side) to create multiple connections to the application host machine from the one Tomcat server?
0
Comment
Question by:quser
7 Comments
 
LVL 15

Accepted Solution

by:
jimmack earned 63 total points
ID: 9718606
Well that's a tricky one to answer.  There's nothing to stop the Tomcat side implementing multiple connections.  You seem to have implied that the problem is more at the other end:

>> The application will only accept one connection from each TCP host

If you can't change that, then you might be able to get around it with some network "jiggery-pokery"*, but I'm not quite sure how.

*According to TimYates, this is "Errr... a technical term" ;-)
0
 
LVL 14

Expert Comment

by:kennethxu
ID: 9719640
solution A, as jimmack said, change the other end and let it accept more connection from one single ip.

solution B, use virtual IP. that means assign multiple ip address to your server. it is OS level thing and platform dependent. then use Socket(InetAddress address, int port, InetAddress localAddr, int localPort)  to make multiple connections.

let us know if you have further enquires.
0
 
LVL 35

Expert Comment

by:TimYates
ID: 9721318
> *According to TimYates, this is "Errr... a technical term" ;-)

HAHAHA :-)
0
 

Author Comment

by:quser
ID: 9721421
An update,

It seems that from talking to the applications producers it will accept multiple connections from a single host through the API (not from their supplied client application though, that is were the confusion came).

However it seems that the application is not multi-threaded and so will block requests when busy.

I suppose I need a solution were I can initiate a request from my Bean / JSP and wait until I recieve a response from the server app?
0
 
LVL 14

Assisted Solution

by:kennethxu
kennethxu earned 62 total points
ID: 9723354
it is true that you should not make too much simultaneous connections even if the server app allows multiple connections. just like database connections.

you should implement a connection pool strategy, that can limit the number of simultaneous connections and eliminate the expensive cost to establish a network connection with server.

you can have a look at jakarta commons pool package, it will make you life a lot easier when implementing a connection pool:
http://jakarta.apache.org/commons/pool/

let us know.
0

Featured Post

Live: Real-Time Solutions, Start Here

Receive instant 1:1 support from technology experts, using our real-time conversation and whiteboard interface. Your first 5 minutes are always free.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
unit test DAO layer 1 137
listing all functions in JavaScript 19 200
runtime exception 2 27
jsp login check 12 27
Troubleshooting common task sequence error codes
One of the biggest threats in the cyber realm pertains to advanced persistent threats (APTs). This paper is a compare and contrast of Russian and Chinese APT's.
This Micro Tutorial will give you a basic overview how to record your screen with Microsoft Expression Encoder. This program is still free and open for the public to download. This will be demonstrated using Microsoft Expression Encoder 4.
Although Jacob Bernoulli (1654-1705) has been credited as the creator of "Binomial Distribution Table", Gottfried Leibniz (1646-1716) did his dissertation on the subject in 1666; Leibniz you may recall is the co-inventor of "Calculus" and beat Isaac…

816 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

Need Help in Real-Time?

Connect with top rated Experts

7 Experts available now in Live!

Get 1:1 Help Now