Back: TCP.ICMPSocketImpl class-implementation Up: TCP package Forward: TCP.IPAddress class-C call-outs   Top: GNU Smalltalk Library Reference Contents: Table of Contents Index: Class index About: About this document

6.7 TCP.IPAddress

Defined in namespace TCP
Superclass: TCP.SocketAddress
Category: Sockets-Protocols

6.7.1 TCP.IPAddress class: C call-outs  (class)
6.7.2 TCP.IPAddress class: C constants  (class)
6.7.3 TCP.IPAddress class: constants  (class)
6.7.4 TCP.IPAddress class: initialization  (class)
6.7.5 TCP.IPAddress class: instance creation  (class)
6.7.6 TCP.IPAddress: accessing  (instance)
6.7.7 TCP.IPAddress: printing  (instance)


6.7.1 TCP.IPAddress class: C call-outs

primAnyLocalAddress: hostName in: byteArray
Not commented.


6.7.2 TCP.IPAddress class: C constants

addressFamily
Not commented.

protocolFamily
Not commented.


6.7.3 TCP.IPAddress class: constants

addressSize
Answer the size of an IPv4 address.

version
Answer the version of IP that the receiver implements.


6.7.4 TCP.IPAddress class: initialization

createLocalAddress
Answer 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. This is 127.0.0.1 for IPv4.

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

initialize
Set up the default implementation classes for the receiver


6.7.5 TCP.IPAddress class: instance creation

fromArray: parts
Answer a new IPAddress from an array of numbers; the numbers are to be thought as the dot-separated numbers in the standard numbers-and-dots notation for IPv4 addresses.

fromBytes: aByteArray
Answer a new IPAddress from a ByteArray containing the bytes in the same order as the digit form: 131.175.6.2 would be represented as #[131 175 6 2].

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

fromString: aString
Answer a new IPAddress from a String containing the requested address in digit form. Hexadecimal forms are not allowed.

An Internet host address is a number containing four bytes of data. These are divided into two parts, a network number and a local network address number within that network. The network number consists of the first one, two or three bytes; the rest of the bytes are the local address.

Network numbers are registered with the Network Information Center (NIC), and are divided into three classes--A, B, and C. The local network address numbers of individual machines are registered with the administrator of the particular network.

Class A networks have single-byte numbers in the range 0 to 127. There are only a small number of Class A networks, but they can each support a very large number of hosts (several millions). Medium-sized Class B networks have two-byte network numbers, with the first byte in the range 128 to 191; they support several thousands of host, but are almost exhausted. Class C networks are the smallest and the most commonly available; they have three-byte network numbers, with the first byte in the range 192-223. Class D (multicast, 224.0.0.0 to 239.255.255.255) and E (research, 240.0.0.0 to 255.255.255.255) also have three-byte network numbers.

Thus, the first 1, 2, or 3 bytes of an Internet address specifies a network. The remaining bytes of the Internet address specify the address within that network. The Class A network 0 is reserved for broadcast to all networks. In addition, the host number 0 within each network is reserved for broadcast to all hosts in that network. The Class A network 127 is reserved for loopback; you can always use the Internet address `127.0.0.1' to refer to the host machine (this is answered by the #loopbackHost class method).

Since a single machine can be a member of multiple networks, it can have multiple Internet host addresses. However, there is never supposed to be more than one machine with the same host address.

There are four forms of the standard numbers-and-dots notation for Internet addresses: a.b.c.d specifies all four bytes of the address individually; a.b.c interprets as a 2-byte quantity, which is useful for specifying host addresses in a Class B network with network address number a.b; a.b intrprets the last part of the address as a 3-byte quantity, which is useful for specifying host addresses in a Class A network with network address number a.

If only one part is given, this corresponds directly to the host address number.

new
This method should not be called for instances of this class.

with: b1 with: b2 with: b3 with: b4
Answer a new IPAddress whose bytes (from most-significant to least-significant) are in the parameters.


6.7.6 TCP.IPAddress: accessing

addressClass
Answer the `address class' of the receiver (see IPAddress class>>#fromString:)

asByteArray
Answer a read-only ByteArray of size four containing the receiver's bytes in network order (big-endian)

host
Answer an host number for the receiver; this is given by the last three bytes for class A addresses, by the last two bytes for class B addresses, else by the last byte.

isMulticast
Answer whether the receiver reprensents an address reserved for multicast datagram connections

network
Answer a network number for the receiver; this is given by the first three bytes for class C/D/E addresses, by the first two bytes for class B addresses, else by the first byte.

subnet
Answer an host number for the receiver; this is 0 for class A addresses, while it is given by the last byte of the network number for class B/C/D/E addresses.


6.7.7 TCP.IPAddress: printing

printOn: aStream
Print the receiver in dot notation.



Back: TCP.IPAddress-accessing Up: TCP.IPAddress Forward: TCP.MulticastSocket   Top: GNU Smalltalk Library Reference Contents: Table of Contents Index: Class index About: About this document


This document was generated on May, 22 2008 using texi2html