Scripting Guide > Extending JMP > Use Sockets in JSL > Socket-Related Commands
发布日期: 08/07/2020

Socket-Related Commands

Before creating and using a socket, you might need to retrieve information about the end that you want to connect to. GetAddrInfo( ) and GetNameInfo( ) each takes an address argument and an optional port argument and returns a list of information. For example:

Print( Get Addr Info( "www.sas.com" ) );
Print( Get Addr Info( "www.sas.com", "80" ) );
Print( Get Name Info( "149.173.5.120" ) );

{"Get Addr Info", "ok", {"PF_INET", "SOCK_0", "IPPROTO_0", "149.173.5.120", "0"}}

{"Get Addr Info", "ok", {"PF_INET", "SOCK_0", "IPPROTO_0", "149.173.5.120", "80"}}

{"Get Name Info", "ok", {"PF_INET", "SOCK_0", "IPPROTO_0", "www.sas.com", "0"}}

Sometimes there can be more than one answer. In that case, the sublist might be repeated one or more times. These functions can be quite slow; you probably should not try to build a data table of every website name with it. For IPV6 compatibility, you should generally use names like “www.sas.com” rather than the numerical form of an address.

需要更多信息?有问题?从 JMP 用户社区得到解答 (community.jmp.com).