Improve company productivity with a Business Account.Sign Up

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

Testing Java Sockets on Local Computer

Hello Experts!

I am doing a homework from Distributed Programming, and thus far everything goes fine.

The only way to test my applications is to use the only computer I have as a Client, Server and a Workstation at the same time.

The problem is that I want to check how applications behave when some error happens during the transfer of big files (for example server goes down,...).

Since my client, server and workstation apps reside on the same computer they have the same IP's and the transfers are done immediately, no matter how big files are. I tried to use both localhost and my external IP address, but there is no actual trrafic! Therefore I am not able to simulate above mentioned exceptional situations.

Is there any way to simulate real traffic between two applications on the same computer. I use Java Sockets.

Thank you.
0
UrosVidojevic
Asked:
UrosVidojevic
  • 3
  • 3
  • 2
  • +1
3 Solutions
 
shaz_Commented:
well.. not really.. i understand wat ure doing.. i had a similar issue while working on a p2p application... the best u can do is put a thread timeout after every so and so packets transfered.
0
 
sciuriwareCommented:
I would borrow an old laptop or such and connect it UTP-UTP (cross).
The laptop might run LINUX or OSX, no worries.
To make it more critical, run a bunch of virus scans on both machines.
That helped me a lot.

;JOOP!
0
 
shaz_Commented:
lol love the virus scan idea sciuriware heh.. but yeh ..either its another machine or intentionally put delays on your transfer.. like i mentioned before
0
Get 10% Off Your First Squarespace Website

Ready to showcase your work, publish content or promote your business online? With Squarespace’s award-winning templates and 24/7 customer service, getting started is simple. Head to Squarespace.com and use offer code ‘EXPERTS’ to get 10% off your first purchase.

 
CEHJCommented:
Why don't you get a friend (or one of us) to run client/server?
0
 
sciuriwareCommented:
Never, never, never put delays intentionally!   Life isn't like that!

I've seen so many "tested" applications fail after seconds in production.

;JOOP!
0
 
shaz_Commented:
mm well its just to get him started since he does not seem to have another machine... ofc would never say to have an "intentionally delayed" system in production!!
0
 
CEHJCommented:
In one of your reading loops you can introduce some random fallibility thus:


assert Math.random() < 0.95;

Unless assertions are enabled in the jvm, the lines will simply be ignored, making it easy to turn on and off
0
 
UrosVidojevicAuthor Commented:
Thank you very much for your suggestions. My life would be much easier if this could be done on a single machine, but it seems I will have to visit university lab.

Unfortunately I can't send applications to my friends because i need to evaluate results of many test cases and try different failing scenarios. This can last for hours... and I need direct feedback.

In the meantime I will divide transfers into segments with delay, and do some stress testing as you suggested.

Once again thank you.
0
 
CEHJCommented:
:-)
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Upgrade your Question Security!

Your question, your audience. Choose who sees your identity—and your question—with question security.

  • 3
  • 3
  • 2
  • +1
Tackle projects and never again get stuck behind a technical roadblock.
Join Now