Methods to get all addresses for a given hostname (multihomed hosts)
authorStefan Vogel <sv@exept.de>
Thu, 08 Nov 2007 15:03:14 +0100
changeset 1908 7d5c6c7d805f
parent 1907 839cd32bb1d8
child 1909 c76efba26558
Methods to get all addresses for a given hostname (multihomed hosts)
UDSocketAddress.st
--- a/UDSocketAddress.st	Thu Nov 08 12:14:19 2007 +0100
+++ b/UDSocketAddress.st	Thu Nov 08 15:03:14 2007 +0100
@@ -9,7 +9,6 @@
  other person.  No title to or ownership of the software is
  hereby transferred.
 "
-
 "{ Package: 'stx:libbasic2' }"
 
 SocketAddress variableByteSubclass:#UDSocketAddress
@@ -64,6 +63,15 @@
 
 !UDSocketAddress class methodsFor:'instance creation'!
 
+allForHostName:hostName serviceName:portNrOrName type:socketTypeSymbol
+    (hostName notNil and:[hostName ~= 'localhost']) ifTrue:[
+        self error:'Only local connections possible with UD sockets'.
+        ^ nil.
+    ].
+
+    Array with:(self name:portNrOrName).
+!
+
 anyHost
     "there is nothing like a 'host' for unix domain sockets.
      answer an empty address"
@@ -71,19 +79,6 @@
     ^ self new
 !
 
-hostName:hostName serviceName:portNrOrName type:socketTypeSymbol
-    (hostName notNil and:[hostName ~= 'localhost']) ifTrue:[
-        self error:'Only local connections possible with UD sockets'.
-        ^ nil.
-    ].
-    portNrOrName isNumber ifTrue:[
-        self error:'UD sockets require a path argument'.
-        ^ nil.
-    ].
-
-    ^ self name:portNrOrName
-!
-
 name: pathName
     ^ self new name:pathName
 
@@ -93,6 +88,10 @@
 !
 
 peerName:peerName port:port
+    "use #name:"
+
+    <resource: #obsolete>
+    self obsoleteMethodWarning:'use name:'.
     ^ self name:peerName
 ! !
 
@@ -122,6 +121,9 @@
 !
 
 name:pathName
+    pathName isString ifFalse:[
+        self error:'Unix domain sockets require a path argument'.
+    ].
     self stringAt:3 put:pathName
 !
 
@@ -175,5 +177,5 @@
 !UDSocketAddress class methodsFor:'documentation'!
 
 version
-    ^ '$Header: /cvs/stx/stx/libbasic2/UDSocketAddress.st,v 1.14 2003-11-28 11:17:25 stefan Exp $'
+    ^ '$Header: /cvs/stx/stx/libbasic2/UDSocketAddress.st,v 1.15 2007-11-08 14:03:14 stefan Exp $'
 ! !