Back: Sockets.Socket-stream protocol Up: Sockets package Forward: Sockets.SocketAddress class-abstract   Top: GNU Smalltalk Library Reference Contents: Table of Contents Index: Class index About: About this document

6.20 Sockets.SocketAddress

Defined in namespace Sockets
Superclass: Object
Category: Sockets-Protocols

This class is the abstract class for machine addresses over a network. It also fulfills the function of the C style functions gethostname(), gethostbyname(), and gethostbyaddr(), resolves machine names into their corresponding numeric addresses (via DNS, /etc/hosts, or other mechanisms) and vice versa.

6.20.1 Sockets.SocketAddress class: abstract  (class)
6.20.2 Sockets.SocketAddress class: accessing  (class)
6.20.3 Sockets.SocketAddress class: C call-outs  (class)
6.20.4 Sockets.SocketAddress class: C constants  (class)
6.20.5 Sockets.SocketAddress class: creating sockets  (class)
6.20.6 Sockets.SocketAddress class: host name lookup  (class)
6.20.7 Sockets.SocketAddress class: initialization  (class)
6.20.8 Sockets.SocketAddress: accessing  (instance)
6.20.9 Sockets.SocketAddress: testing  (instance)


6.20.1 Sockets.SocketAddress class: abstract

extractFromSockAddr: aByteArray port: portAdaptor
Private - Answer a new SocketAddress from a ByteArray containing a C sockaddr structure. The portAdaptor's value is changed to contain the port that the structure refers to.

fromSockAddr: aByteArray port: portAdaptor
Private - Answer a new IPAddress from a ByteArray containing a C sockaddr structure. The portAdaptor's value is changed to contain the port that the structure refers to. Raise an error if the address family is unknown.


6.20.2 Sockets.SocketAddress class: accessing

anyLocalAddress
Answer an IPAddress representing a local address.

at: host cache: aBlock
Private - Answer the list of addresses associated to the given host in the cache. If the host is not cached yet, evaluate aBlock and cache and answer the result.

defaultDatagramSocketImplClass
Answer the class that, by default, is used to map between the Socket's protocol and a low-level C interface.

defaultDatagramSocketImplClass: aClass
Set which class will be used by default to map between the receiver's protocol and a low-level C interface.

defaultRawSocketImplClass
Answer the class that, by default, is used to map between the Socket's protocol and a low-level C interface.

defaultRawSocketImplClass: aClass
Set which class will be used by default to map between the receiver's protocol and a low-level C interface.

defaultStreamSocketImplClass
Answer the class that, by default, is used to map between the Socket's protocol and a low-level C interface.

defaultStreamSocketImplClass: aClass
Set which class will be used by default to map between the receiver's protocol and a low-level C interface.

isDigitAddress: aString
Answer whether the receiver can interpret aString as a valid address without going through a resolver.

localHostName
Answer the name of the local machine.

loopbackHost
Answer an instance of the receiver representing the local machine (127.0.0.1 in the IPv4 family).

unknownAddress
Answer an instance of the receiver representing an unknown machine (0.0.0.0 in the IPv4 family).


6.20.3 Sockets.SocketAddress class: C call-outs

primLocalName
Not commented.

primName: address len: len type: addressFamily
Not commented.


6.20.4 Sockets.SocketAddress class: C constants

addressFamily
Not commented.

aiAddrconfig
Not commented.

aiCanonname
Not commented.

protocolFamily
Not commented.


6.20.5 Sockets.SocketAddress class: creating sockets

newRawSocket
Create a new raw socket, providing access to low-level network protocols and interfaces for the protocol family represented by the receiver (for example, the C protocol family PF_INET for the IPAddress class) Ordinary user programs usually have no need to use this method.


6.20.6 Sockets.SocketAddress class: host name lookup

allByName: aString
Answer all the IP addresses that refer to the the given host. If a digit address is passed in aString, the result is an array containing the single passed address. If the host could not be resolved to an IP address, answer nil.

byName: aString
Answer a single IP address that refer to the the given host. If a digit address is passed in aString, the result is the same as using #fromString:. If the host could not be resolved to an IP address, answer nil.


6.20.7 Sockets.SocketAddress class: initialization

anyLocalAddress: anObject
Private - Store an object representing a local address in the address family for the receiver

createLoopbackHost
Answer an object representing the loopback host in the address family for the receiver.

createUnknownAddress
Answer an object representing an unkown address in the address family for the receiver

flush
Flush the cached IP addresses.

initLocalAddresses
Private - Initialize the anyLocalAddress class-instance variable for the entire hierarchy.

update: aspect
Flush all the caches for IPAddress subclasses


6.20.8 Sockets.SocketAddress: accessing

= aSocketAddress
Answer whether the receiver and aSocketAddress represent the same machine. The host name is not checked because an IPAddress created before a DNS is activated is named after its numbers-and-dots notation, while the same IPAddress, created when a DNS is active, is named after its resolved name.

asByteArray
Convert the receiver to a ByteArray passed to the operating system's socket functions)

hash
Answer an hash value for the receiver

name
Answer the host name (or the digit notation if the DNS could not resolve the address). If the DNS answers a different IP address for the same name, the second response is not cached and the digit notation is also returned (somebody's likely playing strange jokes with your DNS).


6.20.9 Sockets.SocketAddress: testing

isMulticast
Answer whether an address is reserved for multicast connections.



Back: Sockets.SocketAddress-accessing Up: Sockets.SocketAddress Forward: Sockets.SocketImpl   Top: GNU Smalltalk Library Reference Contents: Table of Contents Index: Class index About: About this document


This document was generated on August, 19 2010 using texi2html