Java Forums

Main Menu
Home
Today's Posts
FAQ
Search
Contact Us

Java Network
Java Tips
Java Tips Blog

Sponsored Links





Welcome to the Java Forums.

You are currently viewing our boards as a guest which gives you limited access to view most discussions and access our other features. By joining our free community, you will:

  • have access to post topics
  • communicate privately with other members (PM)
  • not see advertisements between posts
  • have the possibility to earn one of our surprises if you are an active member
  • access many other special features that will be introduced later.

Registration is fast, simple and absolutely free so please, join our community today!

If you have any problems with the registration process or your account login, please contact us.

Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 06-17-2008, 05:31 PM
Member
 
Join Date: Jun 2008
Posts: 4
ibtehal is on a distinguished road
inter process communication
Hi,

My code about generate requests simulation, I have to send 400 requests from client to server , I used TCP connection but in some times the server waite from client and the client also waite the response from the server ?
should I use inter-process communication between client and server ,How can I implemnt this .

for (int i=0;i<=400)
{
//send object to server

thread.sleep(-1*Math.log(Math.random());

//receive response object from the server

}
I have to generate my requests exponintially.

Thanks
Bookmark Post in Technorati
Reply With Quote
Sponsored Links
  #2 (permalink)  
Old 06-22-2008, 05:21 AM
fishtoprecords's Avatar
Senior Member
 
Join Date: Jun 2008
Posts: 337
fishtoprecords is on a distinguished road
What's the problem?
It unlikely that any single computer will handle 400 simultaneous network connections, do you expect them all to work at once?

In general, its more reliable to queue requests in the main thread, and have one or more workers that do the actual network communications. The keeps one request from blocking all others.

The Java concurrency modules have suitable tools to build this.
Bookmark Post in Technorati
Reply With Quote
  #3 (permalink)  
Old 06-23-2008, 01:31 AM
Member
 
Join Date: Jun 2008
Posts: 4
ibtehal is on a distinguished road
Thank you very much
Bookmark Post in Technorati
Reply With Quote
  #4 (permalink)  
Old 06-23-2008, 01:52 AM
Nicholas Jordan's Avatar
Senior Member
 
Join Date: Jun 2008
Location: Southwest
Posts: 567
Nicholas Jordan is on a distinguished road
local loopback
If you are doing simulation, do it all in a program you write. You may be able to do 400 requests a second if the calling method and the responding method both reside locally on a machine you own and do not have any exposure to outside network.

You may do a great deal of code testing if the server and the client are both written in the same program for the purpose of doing feasibility studies, ones you wrote yourself and run yourself.

In fact, 4000 requests a second is not infeasible if you do not go to disk, use something from java.util that is classifiyable as Collections to simulate a collection of bytes on disk platter.
Bookmark Post in Technorati
Reply With Quote
  #5 (permalink)  
Old 06-23-2008, 02:00 AM
fishtoprecords's Avatar
Senior Member
 
Join Date: Jun 2008
Posts: 337
fishtoprecords is on a distinguished road
Nick is correct, but I tend to write such programs as two separate small pieces of code, then execute both on the same machine.

Separate programs lets you do things like run several instances of the server code, so you can test the queuing system at assorted load levels
Bookmark Post in Technorati
Reply With Quote
  #6 (permalink)  
Old 06-23-2008, 02:35 AM
Nicholas Jordan's Avatar
Senior Member
 
Join Date: Jun 2008
Location: Southwest
Posts: 567
Nicholas Jordan is on a distinguished road
simple server prototyping
I cannot get Pat's response to show in the thread view but yes, we can code them as separated code units. I sortof had the design idea of a single static access method with some tricky but simple logic so that two threads are running and we have to deal with the synchronized and volatile and so on. That accomplishes several things. First,... we get off of other people's hardware and help departments. Second,... we have to work out the access logic and that brings a conceptual understanding of a process running full duplex ( something that is addressed in a grossly inadequate manner in the plethora of books commonly available ) and Thirdly,... we can now do feasiblity studies on how and if the app will scale when an if someone who knows nothing about techie trys to ship the app to a powerful server..,

Pat, note that I cannot see your full counter-response while authoring this. We may have lost OP,... in which case we may direct poster to the server that ships with the sample code.
Bookmark Post in Technorati
Reply With Quote
Sponsored Links
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
How to use pipes for inter-thread I/O Java Tip java.lang 0 04-09-2008 07:37 PM
i need help in http process sureshjava New To Java 0 01-29-2008 05:56 AM
Communication with c++ mathias Advanced Java 1 08-07-2007 07:47 AM
How can I set a time out on the loading process paul Advanced Java 1 08-07-2007 05:54 AM
Linux process from java Ed New To Java 2 07-04-2007 06:03 AM


All times are GMT +3. The time now is 09:27 PM.


VBulletin, Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO ©2007, Crawlability, Inc.
Copyright ©2006 - 2007, www.java-forums.org