--- a/IPSocketAddress.st Mon Mar 02 23:44:09 2015 +0100
+++ b/IPSocketAddress.st Tue Mar 03 00:13:21 2015 +0100
@@ -1,3 +1,5 @@
+"{ Encoding: utf8 }"
+
"
COPYRIGHT (c) 1995 by Claus Gittinger
All Rights Reserved
@@ -372,7 +374,7 @@
!IPSocketAddress methodsFor:'comparing'!
-hasSameHostAddress:aSocketAddress
+sameHostAddress:aSocketAddress
"answer true, if myself and aSocketAddress have the same host address
(but possibly different ports)."
@@ -582,37 +584,40 @@
self isLocal ifTrue:[^ true].
- "/ For now - work only for ipv4...
- ^ OperatingSystem getNetworkAddresses contains:[:each|
- self sameHostAddress:each
+ OperatingSystem isLinuxLike ifTrue:[
+ "/ make this general later, when getNetworkAddressInfo is implemented in Win32OperatingSystem
+ OperatingSystem getNetworkAddressInfo do:[:eachIfAddrInfoSet|
+ eachIfAddrInfoSet do:[:eachIfAddrInfo|
+ |address|
+ address := eachIfAddrInfo at:#address ifAbsent:nil.
+ address notNil ifTrue:[
+ (self sameHostAddress:address) ifTrue:[^ true].
+ ]
+ ].
].
-
- "/ later, when getNetworkAddressInfo is implemented in Win32OperatingSystem
-"/ OperatingSystem getNetworkAddressInfo do:[:eachIfAddrInfoSet|
-"/ eachIfAddrInfoSet do:[:eachIfAddrInfo|
-"/ |address|
-"/ address := eachIfAddrInfo at:#address ifAbsent:nil.
-"/ address notNil ifTrue:[
-"/ (self sameHostAddress:address) ifTrue:[^ true].
-"/ ]
-"/ ].
-"/ ].
-"/ ^ false
+ ^ false
+ ] ifFalse:[
+ "/ For now - works only for ipv4...
+ ^ OperatingSystem getNetworkAddresses contains:[:each|
+ self sameHostAddress:each
+ ].
+ ].
"
- (IPSocketAddress hostAddress:#[193 141 12 193] port:80) isMyAddress.
(IPSocketAddress hostAddress:#[172 23 1 88] port:80) isMyAddress.
(IPSocketAddress hostAddress:#[192 168 23 29] port:80) isMyAddress.
+ (IPv6SocketAddress addressString:'2003:6A:682B:4500:A288:B4FF:FEC6:1514') isMyAddress.
+ (IPv6SocketAddress addressString:'2001:6A:682B:4500:A288:B4FF:FEC6:1514') isMyAddress.
"
! !
!IPSocketAddress class methodsFor:'documentation'!
version
- ^ '$Header: /cvs/stx/stx/libbasic2/IPSocketAddress.st,v 1.44 2015-02-27 21:09:14 stefan Exp $'
+ ^ '$Header: /cvs/stx/stx/libbasic2/IPSocketAddress.st,v 1.45 2015-03-02 23:13:21 stefan Exp $'
!
version_CVS
- ^ '$Header: /cvs/stx/stx/libbasic2/IPSocketAddress.st,v 1.44 2015-02-27 21:09:14 stefan Exp $'
+ ^ '$Header: /cvs/stx/stx/libbasic2/IPSocketAddress.st,v 1.45 2015-03-02 23:13:21 stefan Exp $'
! !