VARKON Version 1.17D 2003-03-25


 
 

tcp_getremote - function

 

Description

Get information about the remote adress and port to which the specified socket is connected.
 

Syntax

tcp_getremote(socket, adress, port);
 
INT socket
STRING adress
INT port
 

Principal parameters

socket - id of the socket connection to check.
adress - string to retrieve the remote adress to which the specified socket is connected.
port - integer to retrieve the remote port number to which the specified socket is connected.
 

Optional parameters

none
 

Return value

An INT value equal to the current error status as below:
0 = Operation was successful.
-2 = The descriptor is not a socket or the socket is not connected.
-3 = The network subsystem or the associated service provider has failed.
-24 = Winsock routine getpeername() failed.
 

Examples

INT status;
INT socket;
STRING adress*20;
INT port;
 
status := tcp_getremote(socket,address,port);
 
We will receive information about the remote computer (port and adress) connected to the socket connection with id=socket. The adress is given as a string on the form: "nnn.nnn.nnn.nnn".
 

See also

tcp_connect()     tcp_listen()     tcp_close()     tcp_outint()     tcp_inint()     tcp_outfloat()     tcp_infloat()     tcp_outvec()     tcp_invec()     tcp_getlocal()    
 

VARKON Homepage Index