Telnet for Windows XP bugs & My first try to Java network

Last week, during the prac 2 of CS IB, we were asked to program in Java to build a simple client/server system in which the server takes “commands” from the client and executes them. Due to the time restriction, we were only asked to implement the server, and use telnet to act as client to transact with server. You can have a look here for details.

It’s no more than the knowledge above. Maybe the simplest nextwork program in Java world.

The telnet on lab’s Mac just work well, but after I brought my program to home and run on my own computer, I met a really troublesome problem with the Microsoft’s telnet in Windows XP.

1. First, I started my server.

telnet_1.png

2. Then, I opened the console in XP. Typed in the telnet command: telnet localhost 6666 (6666 is my server port number).

telnet_2.png

3. Server side msg indicated that I successfully connected.

telnet_3.png

4. How about the client side?

telnet_4.png

The nice bug come out! When you are typing, you can’t see what you have typed. Why is that? The Google says: When you type your password, local echo is switched off so others cannot see what you are typing. Unfortunately, Telnet fails to switch it back on again, and fails to accept any further entries!

5. solution: press “Ctrl + ]”, then input “set localecho”, and hit return twice. You should now be able to see what you type.

telnet_5.png

6. The whole transaction of my Online Shop Server looks like this (You can check the detailed requirements):

telnet_6.png

  1. Create account
  2. List the products
  3. Add the corresponding products to shopping basket
  4. Commit the transaction
  5. Terminate the session

7. When use “QUIT” command, the connection is closed. But my server keep running.

telnet_7.png

8. Really solved the problem? Unfortunately, you will need to repeat step 5 each time when you enter console. That’s really noising. But I found a really sweet alternative program, called PuTTY.

telnet_8.png

blah, blah, blah just four steps

telnet_9.png

trying to use PuTTY as Telnet to connect my server…

9. Connected again.

telnet_10.png

10. Very pleasant interface.

telnet_11.png

If you have interests, test my code yourself.

Download OnlineShopServer   1360 hits