Solved

Multiple TCP connections from JSP to host application

Posted on 2003-11-10
7
317 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
Comment Utility
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
Comment Utility
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
Comment Utility
> *According to TimYates, this is "Errr... a technical term" ;-)

HAHAHA :-)
0
 

Author Comment

by:quser
Comment Utility
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
Comment Utility
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

Highfive + Dolby Voice = No More Audio Complaints!

Poor audio quality is one of the top reasons people don’t use video conferencing. Get the crispest, clearest audio powered by Dolby Voice in every meeting. Highfive and Dolby Voice deliver the best video conferencing and audio experience for every meeting and every room.

Join & Write a Comment

Marketing can be an uncomfortable undertaking, especially if your material is technology based. Luckily, we’ve compiled some simple and (relatively) painless tips to put an end to your trepidation and start your path to success.
HOW TO: Connect to the VMware vSphere Hypervisor 6.5 (ESXi 6.5) using the vSphere (HTML5 Web) Host Client 6.5, and perform a simple configuration task of adding a new VMFS 6 datastore.
Illustrator's Shape Builder tool will let you combine shapes visually and interactively. This video shows the Mac version, but the tool works the same way in Windows. To follow along with this video, you can draw your own shapes or download the file…
This video demonstrates how to create an example email signature rule for a department in a company using CodeTwo Exchange Rules. The signature will be inserted beneath users' latest emails in conversations and will be displayed in users' Sent Items…

763 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

10 Experts available now in Live!

Get 1:1 Help Now