This week's book giveaway is in the OCAJP 8 forum. We're giving away four copies of OCA Java SE 8 Programmer I Study Guide and have Edward Finegan & Robert Liguori on-line! See this thread for details.
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
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 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.
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
Joined: Jan 07, 1999
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.
Joined: Mar 14, 2001
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