CapeSoft.Com
Clarion Accessories
NetTalk
Doc Index
Upgrading to NetTalk 9
CapeSoft Logo

CapeSoft NetTalk
Upgrading to NetTalk 9

Download Latest Version
Installed Version Latest Version

NetTalk Utility Functions

These functions are exposed by the NetTalk DLL and can be called "as is" without instantiating a class.

NetGetIPInfo

NetGetIPInfo (*Net:IpInfoQType pQueue, long pShortList)

Description

Every computer has multiple IP addresses. This function populates a queue with information about each of the addresses currently assigned to this computer. This function best answers the question "What is the IP address of this machine on the LAN?"

Note that if your computer connects to a server on the WAN (like the internet) and goes through a NAT Router to get there, then that machine will see the IP address of the NAT router, and not any of the addresses in this queue. If you want to know what your IP address is as seen by external servers, then use a WebClient class to access a service like http://whatismyipaddress.com.

Parameters
Parameter Description
pQueueA queue to contain the results of the call. The queue is of type Net:IpInfoQType. This type is declared in \clarion\accessory\libsrc\win\netall.inc

Net:IpInfoQType   Queue, Type
IPAddressCstr       cstring (NET:IPStringSize+1)
SubnetMaskCstr      cstring (NET:IPStringSize+1)
BroadCastCstr       cstring (NET:IPStringSize+1)
Gateway1CStr        cstring (NET:IPStringSize+1)
Gateway2CStr        cstring (NET:IPStringSize+1)
Gateway3CStr        cstring (NET:IPStringSize+1)
Gateway4CStr        cstring (NET:IPStringSize+1)
Gateway5CStr        cstring (NET:IPStringSize+1)
DHCPServerCStr      cstring (NET:IPStringSize+1)
PrimaryWinsCstr     cstring (NET:IPStringSize+1)
SecondaryWinsCStr   cstring (NET:IPStringSize+1)
DCHPenabled         long
WinsEnabled         long
LeaseObtained       long
LeaseExpires        long
AdapterDescription  cstring (128+4)
AdapterName         cstring (256+4)
AdapterType         long
AdapterIndex        long
IPindex             long
MACAddress          string(20)
Family              Long
                  End

pShortListDeprecated: Set it to False. If this property is true then only IP, SubnetMast and BroadCast addresses are filled into the queue.
Return Value

Returns 0 if the function is successful, non zero otherwise.

Examples

qIP          QUEUE(Net:IpInfoQType),PRE()
             END
  Code
  NetGetIPInfo (qIP, 0)
! Get Full List

See also

NetOptions

NetMakeHash

NetMakeHash (*string pInData, long pLength, long pHashType)

Description

Calculates the HASH value of a string.

Note: SHA1 hash type does not appear to be working at this stage.

Parameters
Parameter Description
pInDataThe string to Hash.
pLengthThe length of the incoming string.
pHashTypeOne of the following;
net:CALG_MD5
net:CALG_SHA
net:CALG_SHA1
net:CALG_SHA_256
net:CALG_SHA_384
net:CALG_SHA_512

Return Value


Returns the hash of the string as a binary string value. If you need to convert this to Base64 or HexEncoding then use StringTheory to do that.

Examples

Hash a value in a simple string

str  String(10)
hash  String(1024)
  code
  str = 'abcde'
  hash = NetMakeHash(str,5,net:CALG_SHA_256)


Hash a value in a StringTheory object

str   StringTheory
  code
  str.SetValue('abcde')
  str.SetValue(NetMakeHash(str.GetValuePtr(),str.Length(),net:CALG_SHA_256))
  str.ToHex(st:UPPER)



See also

NetOptions

NetOptions (long flag, *string pData)

Description

NetOptions is a general purpose function which lets you read, and write, various internal NetTalk settings.

Parameters
Parameter Description
flagOne of the equates listed in the table below
pDataThe value to set (when using SET equates) or the result from the function if using GET equates.
Equates

The where column below indicates where the call should be made.
After (You can only call this after the parent call in the Init() method),
Before
(You can only call this before the parent call in the Init() method) or
Either (You can call this anytime you like)

Equate Description Where
NET:COUNTOUTGOINGPACKETSUsed by NetSimple objects to determine the number of outgoing packets that are still in the DLL. Used in the GetInfo() method.After
NET:DNSLOOKUPDoes a DNS lookup on the string that you pass to it. The result is placed in the string. This is a blocking call. In other words processing is suspended while the DNS lookup occurs.After
NET:SETENCRYPTIONKEYCan be used to set a unique encryption key string for your applications. String passed should be of type string (24). Preferably set this early in the loading cycle before packets are sent or received.Before
NET:GETDGINSTANCEGets the datagram instance of your NetAuto instance (starts at 0)After
NET:GETDGPORTGets the datagram port number (see also NET:GETSPORT) Either
NET:SETDGPORTSets the datagram port number (see also NET:SETSPORT) Before
NET:GETDLLVERSIONGets the version out of the DLL being used. If you compile in local mode this will be the version of the .lib file that you compiled with, otherwise it will report the DLL version (standalone build).After
NET:GETDNSLISTGets a comma separated list of the DNS Servers in specified in the Networking TCP/IP properties.After
NET:GETHOSTNAMEGets the hostname of the machine you are usingEither
NET:GETHOSTIPLISTGets a list of IP addresses for this machine.Either
NET:GETIAMASERVICETells NetTalk this process is a Service, and that it should not close down when the current Session Logs OffEither
NET:GETINACTIVESERVICETIMER(Advanced option). Gets the time to wait between polls to inactive servers. (in hs) - This only affects the NetAuto objects.Either
NET:SETINACTIVESERVICETIMER(Advanced option). Sets the time to wait between polls to inactive servers. (in hs) - This only affects the NetAuto objects.Before
NET:GETMAXINSTANCESGets the maximum number of NetAuto instances that you can run on one machine. Either
NET:SETMAXINSTANCESSets the maximum number of NetAuto instances that you can run on one machine. Before
NET:GETNETDESCRIPTIONGets the NetName Description of the current instance. This is the user friendly version of the netname e.g. 'Fred Bloggs at CapeSoft'After
NET:SETNETDESCRIPTIONSets the NetName Description of the current instance. This is the user friendly version of the netname e.g. 'Fred Bloggs at CapeSoft'Before
NET:SETNETDESCRIPTION_ALWAYSSets the NetName description of the current instance. This is the user friendly version of the netname e.g. 'Fred Bloggs at CapeSoft'. This option also stores it in the registry for the next time as well. Before
NET:GETNETIDGets the NetID structure for the current instance. Net:AutoIDType is defined in \clarion\accessory\libsrc\win\netall.inc After
NET:SETNETNAMESets the NetName of your NetAuto InstanceBefore
NET:GETNETNAMEGets the NetName of you NetAuto Instance. You can also call the NetAutoGetNetName() function.After
NET:SETNETAUTOLISTENINGPORTIPAllows you to bind the NetAuto Objects Listening Ports to a specific IP address. This can be useful if you are running multiple network cards, but would only be used in rare situationsBefore
NET:SETRECOVERYOPTIONSSets the NetAuto objects Error Recovery parameters. Demonstrated in the netdemo application. Use the NET:AutoRecoveryOptionsType group.Either
NET:GETRESEND_CloseConnectionBeforeResend (Advanced option only). Indicates if the NetAuto objects' connection will be closed before any error correction resending takes place Either
NET:SETRESEND_CloseConnectionBeforeResend (Advanced option only). Sets if the NetAuto objects' connection must be closed before any error correction resending takes place. Either
NET:GETRESEND_OnlySendIfHostActive (Advanced option only). Indicates if the NetAuto objects' error correction resending takes place only if the Host is active in the Servers queue (ie that there is DG communication between server and client)Either
NET:SETRESEND_OnlySendIfHostActive (Advanced option only). Sets the NetAuto objects' error correction resending to take place only if the Host is active in the Servers queue (ie that there is DG communication between server and client) Either
NET:GETSINSTANCEGets the streamed socket instance of your NetAuto instance (starts at 0)After
NET:GETSPORTGets the streamed port number (see also NET:GETDGPORT) Either
NET:SETSPORTSets the streamed port number (see also NET:SETDGPORT) Before
NET:GETSTATSGet Statistics on how many records are in queues and memory usedAfter
NET:SETUSEONE255BROADCASTTells the NetAuto Broadcast system to use one 255.255.255.255 broadcast instead of one broadcast per subnet. (Not recommended unless you know what you are doing).Either
   
Return Value

The value returns nothing, although the contents of the pData parameter may be changed

Examples

1. Change the base DG port for your system

val   string(20)
 
  val = 27000
  NetOptions(NET:SETDGPORT,val)

2. Change the maximum number of instances of your program (or programs sharing the same Base DG Port) on the same machine.

val   string(20)
 
  val = 10
  NetOptions(NET:NET:SETMAXINSTANCES,val)


3. Use the Stats functionality to tell you how many outgoing NetSimple and NetAuto packets are waiting in the DLL.

SimpleOutData_Size long ! How many outgoing NetSimple packets in DLL
OutgoingPacketsData_Size long
! How many outgoing NetAuto packets in DLL

ourNETStats Group(NET:StatsType).
ourNETSTatsStr String (size(NET:StatsType)),over(ourNETStats)

GetStats Routine
  NetOptions (NET:GETSTATS, ourNetStatsStr)
! Call the DLL and ask for the stats
  SimpleOutData_Size = ourNetStats.qSimpleOutData_Size
  OutgoingPacketsData_Size = ourNetStats.qOutgoingPacketsData_Size


For a complete description of the Net:StatsType group look in \clarion\accessory\libsrc\win\netall.inc.


See also

NetPing

NetPing (String pIP, long pTTL)

Description

Sends a PING to the destination address. Note this is a blocking, syncronous call. The result is returned immediately. Ping only checks to see if the server at the address will respond to a Ping command. It does not check if a port on the machine is open or not. Note that a Ping can fail even if the server is available as many servers are set up to reject Ping packets and not respond to them.

Therefore a successful Ping tells you (only) that a machine exists - it does not tell you if a port is open.
Also a failed Ping does not mean the server is unavailable, only that it has not replied to the Ping.

Parameters

Parameter Description
pIPThe IP address to ping.
pTTLTimeout (in milliseconds. 1000=1 second)

Return Value


Returns either 0 for success or ERROR:PingUnSuccessful if it fails.

Examples

result = NetPing('www.google.com',3000)


[End of this document]
Return to NetTalk Documentation Index