Freezing problem when using Socket/ServerSocket

I'm trying to make something client/server with the classes Socket and ServerSocket. However, I can't get it to work. If I take examples from the internet, it doesn't work, if I take the official Sun examples, doesn't work either, same with homemade stuff. I'll explain.

Let's say I use those from Sun:

http://java.sun.com/docs/books/tutorial/networking/sockets/example-1dot1/KnockKnockClient.java

http://java.sun.com/docs/books/tutorial/networking/sockets/example-1dot1/KnockKnockProtocol.java

http://java.sun.com/docs/books/tutorial/networking/sockets/example-1dot1/KnockKnockServer.java

Those 3 classes should compile. What I do is replace the "taranis"" in KnockKnockClient for the name of my computer since I'm trying to run both the server side and client side on the same computer. After those compile, I run the server one first, as it should be. It stops on that line as it should be:

"clientSocket = serverSocket.accept();"

Then I run the client one, and it automatically freezes. I tried changing the port numbers just in case and it's the same thing. I have no idea what the problem could be.

Thanks for the help.

[1188 byte] By [Mat087a] at [2007-10-2 11:11:33]
# 1
hi I checked with the programs(knockknockclient, protocol and server), its working in my system properly. will u please let us know what error(if any) you get. does the client come out at any time? Better check with the host name that you give.
nvraman_83a at 2007-7-13 3:54:35 > top of Java-index,Archived Forums,Socket Programming...
# 2
I don't get any error message. BlueJ just freeze when I try to run the KnockKnockClient. For the host name I tried using the name of my comp AND the method getHostName(). Both didn't work.
Mat087a at 2007-7-13 3:54:35 > top of Java-index,Archived Forums,Socket Programming...
# 3
I didn't mean getHostName(), but:InetAddress.getLocalHost().getHostName()I don't know how to edit my posts.
Mat087a at 2007-7-13 3:54:35 > top of Java-index,Archived Forums,Socket Programming...
# 4
I found the problem. It's BlueJ. It works perfectly fine on Eclipse.
Mat087a at 2007-7-13 3:54:35 > top of Java-index,Archived Forums,Socket Programming...