SocketTools .NET Edition

NetworkTime.GetTime Method (String, Int32, Int32, Int64)

Get the network time from the specified time server.

[Visual Basic]
Overloads Public Function GetTime( _
   ByVal hostName As String, _
   ByVal hostPort As Integer, _
   ByVal timeout As Integer, _
   ByRef networkTime As Long _
) As Boolean
[C#]
public bool GetTime(
   string hostName,
   int hostPort,
   int timeout,
   ref long networkTime
);

Parameters

hostName
A string which specifies the host name or IP address of the time server.
hostPort
An integer value which specifies the port to connect to on the server. The default port value for a time server is port 123.
timeout
An integer value which specifies the number of seconds until a blocking operation fails and returns an error.
networkTime
A long integer passed by reference which will contain the network time value returned by the server.

Return Value

This method returns a boolean value. If the method succeeds, the return value is true. If the method fails, the return value is false. To get extended error information, check the value of the LastError property.

See Also