Solved

Testing Java Sockets on Local Computer

Posted on 2008-06-24
9
363 Views
Last Modified: 2013-11-19
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
Comment
Question by:UrosVidojevic
  • 3
  • 3
  • 2
  • +1
9 Comments
 
LVL 3

Assisted Solution

by:shaz_
shaz_ earned 100 total points
ID: 21856352
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
 
LVL 24

Accepted Solution

by:
sciuriware earned 200 total points
ID: 21856641
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
 
LVL 3

Expert Comment

by:shaz_
ID: 21856677
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
Master Your Team's Linux and Cloud Stack!

The average business loses $13.5M per year to ineffective training (per 1,000 employees). Keep ahead of the competition and combine in-person quality with online cost and flexibility by training with Linux Academy.

 
LVL 86

Expert Comment

by:CEHJ
ID: 21857141
Why don't you get a friend (or one of us) to run client/server?
0
 
LVL 24

Expert Comment

by:sciuriware
ID: 21857338
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
 
LVL 3

Expert Comment

by:shaz_
ID: 21857461
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
 
LVL 86

Assisted Solution

by:CEHJ
CEHJ earned 200 total points
ID: 21857539
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
 
LVL 7

Author Comment

by:UrosVidojevic
ID: 21857677
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
 
LVL 86

Expert Comment

by:CEHJ
ID: 21857734
:-)
0

Featured Post

DevOps Toolchain Recommendations

Read this Gartner Research Note and discover how your IT organization can automate and optimize DevOps processes using a toolchain architecture.

Question has a verified solution.

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

I've been asked to discuss some of the UX activities that I'm using with my team. Here I will share some details about how we approach UX projects.
Basic understanding on "OO- Object Orientation" is needed for designing a logical solution to solve a problem. Basic OOAD is a prerequisite for a coder to ensure that they follow the basic design of OO. This would help developers to understand the b…
This tutorial covers a step-by-step guide to install VisualVM launcher in eclipse.
The viewer will learn how to create and use a small PHP class to apply a watermark to an image. This video shows the viewer the setup for the PHP watermark as well as important coding language. Continue to Part 2 to learn the core code used in creat…

860 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