Novell is now a part of Micro Focus

Does anyone have any code to retrieve the...

Articles and Tips: qna

01 Aug 2003


Q.

Does anyone have any code to retrieve the IPX/SPX network address of a workstation object? I can get as far as retrieving an enumeration of the "Network Address" attributes of the object, but I can't work out how to get any values. Please help.

A.

Making sense of what's returned from a network address is a pain. The network address attribute can be cast off to a NdsNetAddress object. Use the getAddress() method of this class to retrieve an array of unsigned bytes that contains the address. You then have take this array and convert each unsigned byte into a useful int value like this:

int addressSegment = b[i] & 0xff;

I have attached a method I use to do this for "Network Address" attributes. This method works for User objects and is useful in determining if a user is logged in. For workstation objects, I think you only need to change the attribute that is retrieved to "WM:Network Address". It works for IP, UDP, TCP, and IPX addresses. It just returns a vector of strings like "IP: 192.168.53.53". If the vector size is 0, no addresses were found.

* Originally published in Novell AppNotes


Disclaimer

The origin of this information may be internal or external to Novell. While Novell makes all reasonable efforts to verify this information, Novell does not make explicit or implied claims to its validity.

© Copyright Micro Focus or one of its affiliates