NetStreams NSMain

See also object creation information - ClassID/ProgID 

Overview | Reference


The NSMain object can be positioned as feature dispatcher and provider of functionality not applicable to another particular object from the library. It also initializes the WinSock and uninitalizes it when released. Thus the best practice is to keep one such object in the memory while using the library - first to create and last to release. Although the direct creation of the most of the other objects is possible it is not the best way for their usage - prefer NewXXXX methods (see below). 


method.gif (107 bytes) NewSocket Syntax:
Set object = object.NewSocket

Creates a new uninitialized SocketStream object.

method.gif (107 bytes) NewAddress Syntax:
Set object = object.NewAddress

Creates a new uninitialized SocketAddress object.

method.gif (107 bytes) NewOption Syntax:
Set object = object.NewOption

Creates a new uninitialized SockOpt object.

method.gif (107 bytes) NewSelectHelper Syntax:
Set object = object.NewOption

Creates a new uninitialized SocketSelectHelper object.

method.gif (107 bytes) GetHost Syntax:
Set addr = object.GetHost(address [, address_family])

Returns a new SocketAddress object initialized with the address passed.


address - can be a string or an integer (long 4 byte) value. The passed value can be an IP address or a DNS name. If it is an IP the returned address object will be initialized with it. If it is a DNS name a name lookup will be performed which may result in an error if the lookup is unsuccessful.

You can pass for example:
"" - a DNS name to be resolved
"" - an IP to be packet in address object
&HC0A8010C - an integer containing IP address to be packed into an address object.

address_family - is by default AF_INET (2) and is the only supported address family by this function in the current version. IPV6 lookup requires WinSock 2 and because of it is not implemented in this version of NetStreams.


Using this method you do not have to care about what you have IP or a DNS name. The returned value will be IP address packed in a SocketAddress object ready for further usage. IRDA devices lookup requires certain limited resources and is implemented as option query through the SocketStream object in order to avoid tempting the developers write code that will involve more resources allocation.


newObjects Copyright 2001-2006 newObjects [ ]