Get Client IP address and Client hostname using Citrix ICO SDK

Added by Vishal Ganeriwala , last edited by Vishal Ganeriwala on Mar 05, 2008  (view change)
Tags: 

The following example illustrates the use of methods and properties available to get  client network name and IP address information using Citrix ICO SDK

Description

It is possible to Client IP address using ICO SDK. There are couple of use cases where a published application may want to do some logic based on the clien IP address in that case developers can use "GetClientAddress" API to retrieve client IP address.

Code Snippet

Save the code below as icoexample.html and click on connect to server to run examples.
Please change value="10.2.248.105" in below code to your XenApp Server

<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<title>Client address example</title>

<script language="JavaScript">
    <!--
    function GetClientNetworkName(form)
    {
        form.netname.value = document.ICO1.GetClientNetworkName()
    }
    function GetAddrCnt(form)
    {
        form.addrcnt.value = document.ICO1.GetClientAddressCount()
    }
    function GetAddr(form)
    {
        form.addr.value = document.ICO1.GetClientAddress(0)
    }
    function MyStartup()
    {document.ICO1.Startup()
    }
    //-->
   </script>
</head>

<body onLoad="MyStartup()">
<h1>Client address example</h1>
<center>
<br>
<object
id="ICO1" classid="clsid:238F6F83-B8B4-11cf-8771-00A024541EE3" height=480 width=640>
<param name="Address" value="10.2.248.105">
</object>
<br>
</center>

<form name=results>
<center>
<table>
<tr><td>NetworkName:</td><td><input type=text name=netname
size=50></td></tr>
<tr><td>AddressCount:</td><td><input type=text name=addrcnt
size=5></td></tr>
<tr><td>Address:</td><td><input type=text name=addr size=50></td></
tr>
</table>
<input type=button value="Get network name"
onClick="GetClientNetworkName(this.form)"><br>
<input type=button value="Get address count"
onClick="GetAddrCnt(this.form)"><br>
<input type=button value="Get address"
onClick="GetAddr(this.form)"><br>
</center>
</form>
</body>
</html>

User Rating?

Disclaimer

These software applications are provided to you as is with no representations, warranties or conditions of any kind. You may use and distribute it at your own risk. CITRIX DISCLAIMS ALL WARRANTIES WHATSOEVER, EXPRESS, IMPLIED, WRITTEN, ORAL OR STATUTORY, INCLUDING WITHOUT LIMITATION WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NONINFRINGEMENT. Without limiting the generality of the foregoing, you acknowledge and agree that (a) the software application may exhibit errors, design flaws or other problems, possibly resulting in loss of data or damage to property; (b) it may not be possible to make the software application fully functional; and (c) Citrix may, without notice or liability to you, cease to make available the current version and/or any future versions of the software application. In no event should the code be used to support of ultra-hazardous activities, including but not limited to life support or blasting activities. NEITHER CITRIX NOR ITS AFFILIATES OR AGENTS WILL BE LIABLE, UNDER BREACH OF CONTRACT OR ANY OTHER THEORY OF LIABILITY, FOR ANY DAMAGES WHATSOEVER ARISING FROM USE OF THE SOFTWARE APPLICATION, INCLUDING WITHOUT LIMITATION DIRECT, SPECIAL, INCIDENTAL, PUNITIVE, CONSEQUENTIAL OR OTHER DAMAGES, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. You agree to indemnify and defend Citrix against any and all claims arising from your use, modification or distribution of the code.

  • Add to Bookmarks