aspose file tools*
The moose likes Sockets and Internet Protocols and the fly likes Server Socket and Windows XP Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Sockets and Internet Protocols
Bookmark "Server Socket and Windows XP" Watch "Server Socket and Windows XP" New topic
Author

Server Socket and Windows XP

sopal Pal
Ranch Hand

Joined: Aug 04, 2003
Posts: 83
Hi
I created a ServerSocket in my Program on an unused port.
The ServerSocket creation goes on fine. This is running on an XP Box.

** I have turned on Firewall protection in XP.
After sometime I get this system error message from the System which says

Windows Security Alert

Do want to keep blocking this program
Name : java
Publisher : Unknown

This never happened on a Windows 200o box and as soon as I remove the ServerSocket Code it works fine.

Any idea why this is happening.
Thanks for the time and help

Sumit


SCEA, SCBCD, SCJP1.4, OOAD-UML, OCP 9i
Rovas Kram
Ranch Hand

Joined: Aug 08, 2003
Posts: 135
I have turned on Firewall protection in XP.


I'm assuming that you didn't have the Firewall protection in Win 2000 when I guess that you need to configure your firewall to accept that socket.
sopal Pal
Ranch Hand

Joined: Aug 04, 2003
Posts: 83
Hi Rovas
I am trying to prepare for the scenario in Win XP SP2, where Firewall is turned on by default.

IN that case my application would not work at all.
In Win 2000 and WinXP SP1 the firewall is off by default and it works.

When I create an instance of ServerSocket am I listeneing to it.
I think that unless I make the call to do - accept I am not listeneing.
So why does the System croak back when I am not actually listening.

Sumit
Rovas Kram
Ranch Hand

Joined: Aug 08, 2003
Posts: 135
The following code is what I expect you have coded.



When you run this code, the server is listening on your port. Am I right?
[ August 09, 2004: Message edited by: Rovas Kram ]
sopal Pal
Ranch Hand

Joined: Aug 04, 2003
Posts: 83
Hi
Even before I do the blocking accept call - I get this message from the system.
That is the most confusing part.
Why is it even preventing that.
Sumit
Rovas Kram
Ranch Hand

Joined: Aug 08, 2003
Posts: 135
Hi Sopal,

I read in the java api for ServerSocket that the constructor binds the socket to the port. Maybe that means that after the ServerSocket is constructed but before accept is called the OS has already been informed that the port is in use - thus the message your receiving.
sopal Pal
Ranch Hand

Joined: Aug 04, 2003
Posts: 83
Hi
So does this mean that in order to run an application that uses ServerSocket code - the firewall protection has to be turned off.
Does this sound logical. In that case - any web server / rmi server running on the Windows XP box has to turn off the firewall before the server can even start.
Your time and advise is highly appreciated.
Sumit
Rovas Kram
Ranch Hand

Joined: Aug 08, 2003
Posts: 135
I don't know a lot about firewalls but my understanding is that you have to specifically open ports up. For example, if you want to let anyone use your ftp server, you have to configure your firewall to accept connections to port 25 from everyone. In your case, you'd have to use a specific port for your socket and then enable connections to that port.
 
jQuery in Action, 2nd edition
 
subject: Server Socket and Windows XP