Solved

Testing Java Sockets on Local Computer

Posted on 2008-06-24
9
365 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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
Creating Instructional Tutorials  

For Any Use & On Any Platform

Contextual Guidance at the moment of need helps your employees/users adopt software o& achieve even the most complex tasks instantly. Boost knowledge retention, software adoption & employee engagement with easy solution.

 
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

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Today, the web development industry is booming, and many people consider it to be their vocation. The question you may be asking yourself is – how do I become a web developer?
When the s#!t hits the fan, you don’t have time to look up who’s on call, draft emails, call collaborators, or send text messages. An instant chat window is definitely the way to go, especially one like HipChat. HipChat is a true business app. An…
This video teaches users how to migrate an existing Wordpress website to a new domain.
Viewers will learn how to properly install Eclipse with the necessary JDK, and will take a look at an introductory Java program. Download Eclipse installation zip file: Extract files from zip file: Download and install JDK 8: Open Eclipse and …

705 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