Back to product page

Hostname function


Determines the Hostname of remote server.

Type

A Long value. If successful, 0 is returned, otherwise error as specified here

Syntax

  • C
long Sftp_GetHostname(void *Sftp, char *Buffer, int *Bufsize);
long Sftp_SetHostname(void *Sftp, char *newVal);
The Hostname(void *Sftp,char *Buffer,int *Bufsize) syntax has these parts:
void *SftpHandle of the created Sftp instance.
char *BufferBuffer that will hold the returned string. Represents the hostname or IP address of the server.
int *BufsizeSize of the buffer.

Remarks

Prior to issuing the Connect method, you should set the Hostname property to the name of the remote server, or its IP address. wodSFTP will resolve the supplied string and use the resultant value when the Connect method is called.

Resolution of the hostname can take a few seconds and its behaviour will depend on your operating system. It is possible that the component will freeze during this time because name resolution is a blocking call. There is nothing wodSFTP can do internally to prevent it from happening.

The Bufsize variable should contain the maximum length of data that can be stored in Buffer variable. If you set Bufsize = 0, then the function will return with error ERROR_INSUFFICIENT_BUFFER and Bufsize will contain the required buffer size.

Platforms

Windows