aspose file tools*
The moose likes Sockets and Internet Protocols and the fly likes Testing Server Programs w/ only one VM Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Sockets and Internet Protocols
Bookmark "Testing Server Programs w/ only one VM" Watch "Testing Server Programs w/ only one VM" New topic
Author

Testing Server Programs w/ only one VM

Fred Gerson
Greenhorn

Joined: Mar 14, 2001
Posts: 3
Anybody have any good ideas about testing server programs if you have access to only a single virtual machine?
Should I shell out some money to run my programs on a host, is this the best solution? If so, what are some good hosts to use?
Thanks a lot,
Fred
Carl Trusiak
Sheriff

Joined: Jun 13, 2000
Posts: 3340
What type of Server Programs are you running? What platform are you on? You can run multiple instances of your JVM on the same machine and test locally. If you are testing servlet or JSP programs you could get an account with http://www.mycgiserver.com


I Hope This Helps
Carl Trusiak, SCJP2, SCWCD
Frank Carver
Sheriff

Joined: Jan 07, 1999
Posts: 6920
I think you may be confused about what the "virtual" in virtual machine means. because Java runs in a "virtual" machine, you can run as many of these virtual machines as will fit in the memory of your physical machine. When developing with Jini, for example, it's not unusual to run five or more VMs at once for different services, and on my servlet server, I run a separate VM for each customer so there may be up to 50 or so running at once.
For your use, feeel free to run your server in one VM on your physical machine, and one or more client programs in other VMs on the same physical machine.


Read about me at frankcarver.me ~ Raspberry Alpha Omega ~ Frank's Punchbarrel Blog
Fred Gerson
Greenhorn

Joined: Mar 14, 2001
Posts: 3
Thanks for the response guys. I think my confusion is coming from not really knowing how the TCP/IP layer is implemented. Can you run both a client and a server program on the same IP address and port? In this situation with a single IP address and port, when a client makes a request to a server, and then the server responds to the client, why/how is the response not interpreted as another request to the server, and indeed seen as a response to the client?
I really appreciate your help guys.
Thanks a lot,
Fred
Frank Carver
Sheriff

Joined: Jan 07, 1999
Posts: 6920
Typically a server binds to a particular port (HTTP servers use port 80, for example), and only one process can be listening to that port. However, a client program doesn't use a fixed port. When a client program tries to connect to a fixed server port, it is allocated a temporary port for the server to reply to, but you don't care what that port is.
It is quite possible (and many of us do it frequently) to run a server listening to a fixed port, and say half a dozen clients accessing the same server all at once on the same machine.
Fred Gerson
Greenhorn

Joined: Mar 14, 2001
Posts: 3
Thanks guys, I tested both client and server programs last night on my computer and everything worked brilliantly. I am well on my way to testing many server side apps!
Thanks,
Fred
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Testing Server Programs w/ only one VM