#REFACTORING by stefan
class: Socket class
removed: #getRandomAvailablePortOnHost:
--- a/Socket.st Mon Dec 03 17:51:34 2018 +0100
+++ b/Socket.st Thu Dec 06 14:08:18 2018 +0100
@@ -1,5 +1,3 @@
-"{ Encoding: utf8 }"
-
"
COPYRIGHT (c) 1992 by Claus Gittinger
All Rights Reserved
@@ -1424,22 +1422,6 @@
!Socket class methodsFor:'queries'!
-getRandomAvailablePortOnHost:aHostnameOrAdress
- "Attempts binding to port 0 on a specified host, thereby getting assigned a random available port which we return. We then release the socket."
- |socket freePort hostAdress|
-
- aHostnameOrAdress = nil ifTrue: [ hostAdress := '0.0.0.0' ] ifFalse: [ hostAdress := aHostnameOrAdress ].
- socket := Socket newTCP.
- "/ Well this is awkward, since I cant bind this to a remote port and receive a free port there..we spit for luck.
- socket bindTo:0 address:'0.0.0.0' reuseAddress:true.
- freePort := socket port.
- socket abortAndClose.
- ^freePort
-
- "Modified: / 27-11-2018 / 15:16:06 / chris"
- "Modified (comment): / 27-11-2018 / 16:23:45 / chris"
-!
-
peerFromDomain:domain name:peerName port:port
|addrClass|