--- a/IPSocketAddress.st Sun Jul 14 12:13:11 2013 +0200
+++ b/IPSocketAddress.st Tue Jul 16 09:34:25 2013 +0200
@@ -362,6 +362,33 @@
self unsignedShortAt:3 put:aPortNr bigEndian:true
! !
+!IPSocketAddress methodsFor:'converting'!
+
+asIPv4SocketAddress
+ ^ self
+!
+
+asIPv6SocketAddress
+ "convert a IPv4 address to a mapped IPv6SocketAddress"
+
+ |ipv6|
+
+ ipv6 := IPv6SocketAddress new.
+ ipv6
+ port:self port;
+ at:19 put:16rff;
+ at:20 put:16rff.
+
+ ipv6 replaceFrom:21 to:24 with:self startingAt:5.
+
+ ^ ipv6.
+
+ "
+ (self localHost port:80) asIPv6SocketAddress
+ (self localHost port:80) asIPv6SocketAddress asIPv4SocketAddress
+ "
+! !
+
!IPSocketAddress methodsFor:'obsolete'!
address
@@ -560,10 +587,10 @@
!IPSocketAddress class methodsFor:'documentation'!
version
- ^ '$Header: /cvs/stx/stx/libbasic2/IPSocketAddress.st,v 1.38 2013-07-11 15:02:07 stefan Exp $'
+ ^ '$Header: /cvs/stx/stx/libbasic2/IPSocketAddress.st,v 1.39 2013-07-16 07:34:25 stefan Exp $'
!
version_CVS
- ^ '$Header: /cvs/stx/stx/libbasic2/IPSocketAddress.st,v 1.38 2013-07-11 15:02:07 stefan Exp $'
+ ^ '$Header: /cvs/stx/stx/libbasic2/IPSocketAddress.st,v 1.39 2013-07-16 07:34:25 stefan Exp $'
! !