Jim,
Whatever method you use, make sure you wrap it inside of a small Magic batch
program or a function. That way if the method you use to obtain an IP
address changes, the rest of your application will not know the difference.
Keith
From: magicu-l@yahoogroups.com [mailto:magicu-l@yahoogroups.com] On Behalf
Of Erik Hagendijk
Sent: Friday, July 03, 2009 3:50 PM
To: magicu-l@yahoogroups.com
Subject: Re: [magicu-l] Get IP Address of Workstation in UniPaaS 1.8
Hi Jim,
With the ipconfig approach you need to parse the output if you want
just the IP address. The challenge is that the ipconfig output format
depends on IP configuration and Windows version.
As an alternative you can simply initialize or update a Magic variable
with the result of a Java method. The Java method you are looking for
(including the Java source and a one line Magic program calling this
method) can be downloaded from our website.
Just download the file callJava.zip from
http://www.magic2java.com/Calling_Java_Methods.html
. The included .exp files are V9 export programs that show you how to
call the Java methods. Extract the M2J.jar from the zip and include it
in the CLASSPATH (which can be done in your Magic.ini).
Erik
PS Another side benefit of the Java alternative over ipconfig is that
it keeps your Magic application logic portable to non Windows
platforms. Magic application logic that relies on net.get_ip is
portable to non Windows platforms (the M2J converter automatically
replaces your Magic application logic, including calls to net.get_ip
and the net.get_ip functionality with calls to appropriate Java code).
Erik Hagendijk
M2J Software LLC, USA
p +1 (714) 389 2652
f +1 (714) 389 2653
erik@... <mailto:erik%40magic2java.com>
www.magic2java.com
On Jul 3, 2009, at 8:09 AM, Keith Canniff wrote:
>
>
> Jim,
>
> Simple old fashioned way:
>
> Invoke OS (shell to OS), ipconfig >ip.txt
>
> The read the contents of the text file.
>
> Keith
>
> From: magicu-l@yahoogroups.com <mailto:magicu-l%40yahoogroups.com>
[mailto:magicu-l@yahoogroups.com <mailto:magicu-l%40yahoogroups.com> ] On
> Behalf
> Of Jim Stephenson
> Sent: Friday, July 03, 2009 11:06 AM
> To: Magic Mailing List
> Subject: [magicu-l] Get IP Address of Workstation in UniPaaS 1.8
>
> How can I get the IP address of the workstation a UniPaaS 1.8
> application is
> running on?
>
> In previous versions I used net.get_ip. But I can't run get for this
> application (political reasons).
>
> A similar need will also be to get the IP address of a workstation
> that is
> running a UniPaaS application through terminal services. The address
> I will
> want is not the Terminal server, but the remote workstation's.
>
> Jim
>
> [Non-text portions of this message have been removed]
>
> [Non-text portions of this message have been removed]
>
>
>
[Non-text portions of this message have been removed]
[Non-text portions of this message have been removed]