The professional, friendly Java community. 21,500 members and growing!

The Java Programming Forums are a community of Java programmers from all around the World. Our members have a wide range of skills and they all have one thing in common: A passion to learn and code Java. We invite beginner Java programmers right through to Java professionals to post here and share your knowledge. Become a part of the community, help others, expand your knowledge of Java and enjoy talking with like minded people. Registration is quick and best of all free. We look forward to meeting you.

JAVA NETWORK client/server architechture

ok. so this is the Server and client code snippet. please can someone else run it and tell me why my code is giving this much trouble. am using a windows 7 64-bit system on a jdk 7U40 installer. my firewall is turned off from both windows and my antivirus program.
below is the code;

Re: JAVA NETWORK client/server architechture

It thorws a can not connect error. Av tried everything to resolve it from disabling all firewares to installin a 32-bit installer on a 32bit system. To contacting paul deitel, who also suggested this, since its his code. But it keeps throwing the same erro and there's no syntax or logic error from anywhere. If myclient can't connect to a server on my system then...

Re: JAVA NETWORK client/server architechture

your not telling the server what its host IP is.. the port is set to 12345 which is sort of dramatic but should be fine for an example run / learning developer. However you will need to set the IP of the host also.

Re: JAVA NETWORK client/server architechture

Originally Posted by macko

your not telling the server what its host IP is.. the port is set to 12345 which is sort of dramatic but should be fine for an example run / learning developer. However you will need to set the IP of the host also.

Re: JAVA NETWORK client/server architechture

Macko I tried it on vista and it keeps giving me the same can not connect error. Keeping in mind that the genesis of this whole problem came from the can not connect to server error. Could you also give it a trial run on ur OS and see if it would work and if it does, give me your OS specs. Am thinking its a java 7/ windows 7 issue.

Re: JAVA NETWORK client/server architechture

Thanks norm. the fault has been from me all along. instead of me to run two different instances of the command prompt window and run the server application first, i kept running them individually. the application runs without any hassles now. thanks guys for all the assistance.

Re: JAVA NETWORK client/server architechture

Then both programs were executed on the same PC which was using Win7.
Were the server and the client classes executed with their own JVM
or were they both executed in the same JVM from a third class that called their main() methods, server first and then client?

Re: JAVA NETWORK client/server architechture

they were both executed from the same PC using windows7 from different instance of the command prompt window. so its like...
ServerTest.java first, then Client Test .java. but the server test has to run first so it won't throw the connection exception.