SocketAddress.st
changeset 3286 9c62bd367418
parent 3227 553baaf6c227
child 3290 d420c91b7efe
equal deleted inserted replaced
3285:dded4dc30bac 3286:9c62bd367418
   115 
   115 
   116     ^ self hostAddress:self anyAddress
   116     ^ self hostAddress:self anyAddress
   117 !
   117 !
   118 
   118 
   119 fromBytes:bytes
   119 fromBytes:bytes
   120     "create a socket address from bytes (ByteArray), returned by the
   120     "create a socket address from bytes (ByteArray), 
   121      primitive syscalls"
   121      returned by the primitive syscalls.
   122 
   122      Raises an error, if the domainType is not supported by this Smalltalk
   123      |domainSymbol|
   123      (i.e. if libbasic was compiled without support for the corresponding AF_xxx support)"
   124 
   124 
   125      domainSymbol := OperatingSystem domainSymbolOf:(bytes unsignedShortAt:1).
   125     |domainNr domainSymbol|
   126      ^ (SocketAddress newDomain:domainSymbol) fromBytes:bytes.
   126 
       
   127     domainNr := bytes unsignedShortAt:1.
       
   128     domainSymbol := OperatingSystem domainSymbolOf:domainNr.
       
   129     domainSymbol isNil ifTrue:[
       
   130        self error:('unsupported domain (type=%1)' bindWith:domainNr)
       
   131     ].
       
   132     ^ (SocketAddress newDomain:domainSymbol) fromBytes:bytes.
   127 !
   133 !
   128 
   134 
   129 hostAddress:addr
   135 hostAddress:addr
   130     "get a new instance given addr-bytes"
   136     "get a new instance given addr-bytes"
   131 
   137 
   808 ! !
   814 ! !
   809 
   815 
   810 !SocketAddress class methodsFor:'documentation'!
   816 !SocketAddress class methodsFor:'documentation'!
   811 
   817 
   812 version
   818 version
   813     ^ '$Header: /cvs/stx/stx/libbasic2/SocketAddress.st,v 1.43 2014-04-16 22:07:12 cg Exp $'
   819     ^ '$Header: /cvs/stx/stx/libbasic2/SocketAddress.st,v 1.44 2014-05-28 17:16:00 cg Exp $'
   814 !
   820 !
   815 
   821 
   816 version_CVS
   822 version_CVS
   817     ^ '$Header: /cvs/stx/stx/libbasic2/SocketAddress.st,v 1.43 2014-04-16 22:07:12 cg Exp $'
   823     ^ '$Header: /cvs/stx/stx/libbasic2/SocketAddress.st,v 1.44 2014-05-28 17:16:00 cg Exp $'
   818 ! !
   824 ! !
   819 
   825