SocketAddress.st
changeset 1366 e01d0f6c102a
parent 1333 d9ebcc42524c
child 1580 fa4a40f26603
--- a/SocketAddress.st	Wed Nov 26 14:31:11 2003 +0100
+++ b/SocketAddress.st	Fri Nov 28 12:18:01 2003 +0100
@@ -643,6 +643,24 @@
     "
 !
 
+hostNameOrAddressString
+    "answer the host name or the string representation
+     of the address"
+
+    ^ [
+        self hostName.
+    ] on:NameLookupError do:[:ex| |stream|
+        stream := '' writeStream.
+        self printAddressOn:stream.
+        stream contents.
+    ].
+
+    "
+        (IPSocketAddress hostName:'localhost') hostNameOrAddressString
+        (IPSocketAddress hostAddress:#[192 168 8 33]) hostNameOrAddressString
+    "
+!
+
 portOrName
     ^ self subclassResponsibility
 !
@@ -657,8 +675,16 @@
     "
 ! !
 
+!SocketAddress methodsFor:'testing'!
+
+isLocal
+    "answer true, if this address adresses a peer on the same host"
+
+    ^ self subclassResponsibility
+! !
+
 !SocketAddress class methodsFor:'documentation'!
 
 version
-    ^ '$Header: /cvs/stx/stx/libbasic2/SocketAddress.st,v 1.23 2003-10-17 16:43:03 penk Exp $'
+    ^ '$Header: /cvs/stx/stx/libbasic2/SocketAddress.st,v 1.24 2003-11-28 11:17:08 stefan Exp $'
 ! !