NetStreams SocketAddress
 

See also object creation information - ClassID/ProgID 

Overview | Reference

Overview

The SocketAddress object is intended to hold the addresses for the different address families and protocols supported by the library. Instead of passing the addresses to the methods that require them as strings or numeric values which may involve additional work because of the different textual and numerical representations of the different addresses. Thus the SocketAddress object provides appropriate properties and methods for easy setting up an address in any popular form - textual or numeric. Once set the address can be passed to the SocketStream's method that requires them (Connect and Bind for example). The object is also used by some properties that return addresses (see Address, SocketAddress, PeerAddress and also GetOption for IRDA devices lookup - see IRDADeviceInfo object for more information). In these cases you can read the returned address in the form you need it - textual or numeric or compose it in the display form in which you need it.

Reference

AddressFamily Syntax:
af = object.AddressFamily
object.AddressFamily = af

af - is a short integer (2-bytes) code of the address family. Alternatively you can set/get the address family using readable name (AddressFamilyName property) which is probably most convenient for scripting applications. The address family codes are:

2 - AF_INET - IPV4 address
26 - AF_IRDA - IRDA address (on desktop - Windows PC only)
22 - AF_IRDA - IRDA address (on Windows CE only)
23 - AF_INET6 - IPV6 address

Note that IRDA protocol has different codes on the different platforms. Applications working with IRDA are encouraged (especially the scripting applications) to use address family names through the AddressFamilyName property.

AddressFamilyName Syntax:
af = object.AddressFamilyName
object.AddressFamilyName = af

af - is a string containing the code name of the AddressFamily:

"AF_INET" - IPV4 address
"AF_IRDA" - IRDA address (on desktop - Windows PC only)
"AF_INET6" - IPV6 address

The names are case sensitive.

AddressPart Indexed property.
Syntax: 
v = object.AddressPart(n)
object.AddressPart(n) = v

v - an integer value cast internally to the appropriate type for the object's address type. For example for IP V4 and IRDA only the less significant byte has a meaning (values 0 - 255), for IP V6 the less significant 2 bytes are considered meaningful.

n - the part number. Most addresses are often represented as series of numbers, for example IPV4 192.168.1.5. The part number is an index in this chain - from the most significant to the lest significant (in the same order you see it on the screen).

Remarks:
This property allows the application set parts of the address individually. The part index (n) and the size of the part varies according to the protocol. For IPV4 and IRDA they are one byte each (0-255), for IPV6 they are 2 bytes each (0-65536). This corresponds to the most popular standart text representations of the address types supported.

Note that the address family must be set before using this property.

BinAddress Syntax:
addr = object.BinAddress
object.BinAddress = addr

addr - Is a VARIANT containing array of bytes (VT_UI1 | VT_ARRAY). It contains the binary representation of the socket address.

This is used internally and can be useful for C++ programs using the object to obtain the corresponding sockaddr_xxxx structure content in a single step. The array content can be directly copied into the address structure for the object's address type and vice versa.

FlowInfo Syntax:
object.FlowInfo = fi
fi = object.FlowInfo

fi - integer (long 4 byte). The flowinfo parameter for the IP V6 protocol. Ignored in address types.

Note that the address family must be set to AF_INET6 before using this property.

Port Read/Write property
Syntax:
object.Port = p
p = object.Port

p - Integer value. The actual range depends on the protocol. Currently this property serves the IP V4/V6 protocols.

Note that the address family must be set to one of the IP address families before using this property. 

ServiceName Syntax:
object.ServiceName = srv_name
srv_name = object.ServiceName

srv_name - The service name for IRDA addresses. This acts just like the port number for IP protocols. In fact internally 7 bit port numbers are used (7-bit fields), but this is done transparently for the applications (on the both sides - server and the client). The service name must be 1-22 characters long, if it is longer it will be truncated.

Remarks:
Because of the limitations of the IRDA support on some devices it is strongly recommended to use ASCII symbols only (IF you are building server application you will need to choose a service name for it).

Note that the address family must be set to AF_IRDA before using this property.

TextAddress Syntax:
object.TextAddress = addr
addr = object.TextAddress

addr - A string representing the address. This property can be used to set the address value using a string or to retrieve the string representation of the current address value.

The textual address syntax supported is as follows:

IPv4 - a1.a2.a3.a4
Each element is a decimal number between 0 and 255

IRDA - a1.a2.a3.a4
Each element is a decimal number between 0 and 255

IPv6 - w1:w2:w3:w4:w5:w6:w7:w8
Each element is a decimal number between 0 and 65535

Note that the address family must be set before using this property.

Valid Syntax:
b = object.Valid

Boolean read only property - indicates if the object contains valid address.
(added in 1.0.0.4)

...

newObjects Copyright 2001-2006 newObjects [ ]