wood burning stoves 2.0*
The moose likes Sockets and Internet Protocols and the fly likes Sockets under Windows XP OS Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of OCM Java EE 6 Enterprise Architect Exam Guide this week in the OCMJEA forum!
JavaRanch » Java Forums » Java » Sockets and Internet Protocols
Bookmark "Sockets under Windows XP OS" Watch "Sockets under Windows XP OS" New topic

Sockets under Windows XP OS

Sree Nivas
Ranch Hand

Joined: Jul 24, 2003
Posts: 95

A simple Java socket programming is not working in windows XP home edition OS. I'm getting the following error. I'm running server in one DOS window and client in another DOS window. daytimeClient is my client program name.

java.net.ConnectException: Connection refused: connect
at java.net.PlainSocketImpl.socketConnect(Native Method)
at java.net.PlainSocketImpl.doConnect(Unknown Source)
at java.net.PlainSocketImpl.connectToAddress(Unknown Source)
at java.net.PlainSocketImpl.connect(Unknown Source)
at java.net.Socket.<init>(Unknown Source)
at java.net.Socket.<init>(Unknown Source)
at daytimeClient.main(daytimeClient.java:11)

But the same server and client programs are working fine in my work pc. Windows XP OS is not supporting Java socket programming or some other reason?
Pl clarify.

Joe Ess

Joined: Oct 29, 2001
Posts: 8877

Do you have the XP Internet Connection Firewall running?

"blabbing like a narcissistic fool with a superiority complex" ~ N.A.
[How To Ask Questions On JavaRanch]
Sree Nivas
Ranch Hand

Joined: Jul 24, 2003
Posts: 95
Yes or No. I'm not sure about this. But I have internet connection. Pl tell me if Yes what to do or if no what's the solution?

Sree Nivas
Ranch Hand

Joined: Jul 24, 2003
Posts: 95
As described in archive, I enabled firewall and created manually port for my java socket program and tried. But still my client program is not running and giving same error message.

Also tried by disabling firewall, still same problem is occuring.

Could any tell me the what's wrong in running Java sockets in XP home edition OS. The same programs (Server & client) running in my work pc fine.

jeff willis

Joined: Jul 29, 2004
Posts: 25
During times like this, I like to just try to ping the client from the server and visa versa.

If you cannot do that, then at least we can eliminate JAVA as a possible suspect here.
Paul Santa Maria
Ranch Hand

Joined: Feb 24, 2004
Posts: 236
Hi -

1. I'm curious if you made any progress resolving this problem since your first post last Sep 23 (a little over a week ago).

2. "TCP/IP is TCP/IP", and "sockets are sockets". So no, in general, it should *not* be an issue whether or not the program is written in Java or not.

3. The specific error, "Connection refused", indicates that your (XP?) server process failed to connect to your (Java?) client - i.e. that the first place to look for the source of the problem is on the *server* side.

4. The key question is "What's different between the (XP?) client that works and the Java client that fails?

Do both clients execute on the same host? The same OS? Can you run *both* clients in a different window at the same time, and have only one fail?

5. Perhaps the best tool for answering question 4) is "Ethereal" (www.ethereal.org).

Good luck - and please let us know what happens!

Your .. PSM

Paul M. Santa Maria, SCJP
Don't get me started about those stupid light bulbs.
subject: Sockets under Windows XP OS