Go Premium for a chance to win a PS4. Enter to Win

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 348
  • Last Modified:

Multiple TCP connections from JSP to host application

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
quser
Asked:
quser
2 Solutions
 
jimmackCommented:
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
 
kennethxuCommented:
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
 
TimYatesCommented:
> *According to TimYates, this is "Errr... a technical term" ;-)

HAHAHA :-)
0
 
quserAuthor Commented:
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
 
kennethxuCommented:
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

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now