peerAddress

Typefunction
DictionaryLCS
LibraryLiveCode Script
Syntax
the peerAddress of <socketID>
peerAddress(<socketID>)
Summary

Returns the IP address of the remote system at the other end of a socket.

Introduced1.0
OSmac, windows, linux
Platformsdesktop, server
Parameters
NameTypeDescription
socketID

The identifier (set when you opened the socket) of the socket you want to close. The socket identifier starts with the IP address of the host the socket is connected to, and may optionally include a port number (separated from the IP address by a colon). If there is more than one socket connected to that host and port, you can specify which socket by appending the connection name or number that was assigned when the socket was opened, separated from the port number by a vertical bar (|).

Example
peerAddress("ftp.example.org:21")
the peerAddress of "www.example.org:8080|primaryConnection"
the peerAddress of mySocket
Values
NameTypeDescription
return

The peerAddress function returns the IP address of the computer. This address is in the form X.X.X.X, where each X is a number with between 1 and 3 digits.

RelatedCommand: accept, open socket
Function: hostAddress, hostAddressToName, DNSServers
Control Structure: function
Glossary: socket, host, IP address, command, return, port
Description

Use the peerAddress function to find the Internetaddress of the computer a socket is connected to.

The socket must be open. If the specified socket has not been opened, the peerAddress function returns "not an open socket". If you have issued an open socket command to create the socket, you cannot use the peerAddress function until after the socket has been created and the command has completed.

The connectionID is needed only if more than one socket is connected to the same port of the same host. The connectionID is assigned by the accept or open socket command that created the socket.

Tagsnetworking