This week's book giveaway is in the Servlets forum.
We're giving away four copies of Murach's Java Servlets and JSP and have Joel Murach on-line!
See this thread for details.
The moose likes Sockets and Internet Protocols and the fly likes Change port on active ServerSocket Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Java » Sockets and Internet Protocols
Bookmark "Change port on active ServerSocket" Watch "Change port on active ServerSocket" New topic
Author

Change port on active ServerSocket

Michael Morris
Ranch Hand

Joined: Jan 30, 2002
Posts: 3451
Does anyone know of a way to transfer the Socket from ServerSocket.accept() to a differnt ServerSocket? For example, ServerSocket ss1 listening on port 1953 accepts a connection from a remote client. Is there any way to plumb that Socket to a new ServerSocket that listens on port 1980 without closing the original Socket and in a manner that is transparent to the client (the client is oblivious to the port change)?
Thanks in advance.
Mike Morris


Any intelligent fool can make things bigger, more complex, and more violent. It takes a touch of genius - and a lot of courage - to move in the opposite direction. - Ernst F. Schumacher
Peter den Haan
author
Ranch Hand

Joined: Apr 20, 2000
Posts: 3252
Not that I know of. Why would you want to?
- Peter
Michael Morris
Ranch Hand

Joined: Jan 30, 2002
Posts: 3451
F##$% Firewall! I have a limited block of ports to work with and would prefer not to waste one of those ports as an allocator nor code the clients to discover which port is available. I had the server machine set up as a DMZ, but was getting hacked to death by some script kiddie with a Linux box. I ran a port scan on him with nmap and he had every backdoor client known running on that machine: BO2K, Subseven, etc. Life was so much simpler when the net consisted of benevolent anarchists.
Mike Morris
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Change port on active ServerSocket
 
Similar Threads
ServerSocket and thread
Socket data read problem !!
accessing a server using socket connection
java.net Socket port number question
simple socket programming