Friday, June 26, 2009

Network ping command by CLR interop

With the use of CLR interop, there doesn't seem to be a limit to what you can do with Ax. Yes, in the past you could write your own COM wrappers to access those DLL functions. But now, you have much more control. And it's faster. Your basic toolbox just got a LOT bigger. All this .NET components are waiting to be used.

Here's a small example. It demonstrates the well known ping command, to check if a computer is online.
Parameters are the Ip address (string format like and the timeout.

static boolean Ping(str myIpAddressStr,int myTimeOut=4000)
{ System.Net.NetworkInformation.Ping myPing;
System.Net.NetworkInformation.PingReply myPingReply;
System.Net.IPAddress myIPAddress;
System.Net.NetworkInformation.IPStatus myIpStatus;
str myIPStatusStr;

return false;

myIPAddress = System.Net.IPAddress::Parse(myIPAddressStr);
myPing = new System.Net.NetworkInformation.Ping();

return true;

return false;

I'll post some more samples later on.



No comments:

Post a Comment