Name
GetConnectionProtocol -- get protocol of remote side (V8.0)
Synopsis
protocol = GetConnectionProtocol(id[, port])
Function
This command returns the Internet protocol of the connection object specified in id. This can either be the identifier of a server connection obtained by a call to OpenConnection(), the identifier of a client connection obtained by listening to the OnConnect and OnReceiveData events using InstallEventHandler(), or it can be the identifier of a UDP object created by CreateUDPObject().

The optional argument type specifies the type of the network object passed in argument 1. The following types are currently supported by this function:

#NETWORKCONNECTION:
Query the protocol of a connection obtained by a call to OpenConnection(), or the protocol of a client connection obtained by listening to the OnConnect and OnReceiveData events that can be installed using the command InstallEventHandler().

#NETWORKUDP:
Query the protocol of a UDP object created using the CreateUDPObject() call.

If you omit the optional type argument, it will default to type #NETWORKCONNECTION.

The return value will be one of the following predefined constants:

#IPV4:
Internet Protocol version 4 (IPv4). IPv4 addresses are limited to 32 bits and are represented using four numbers separated by three dots, e.g. 127.0.0.1.

#IPV6:
Internet Protocol version 6 (IPv6). IPv6 addresses use 128 bits and are represented by eight groups of four hexadecimal digits, e.g. 2001:0db8:85a3:0000:0000:8a2e:0370:7334. Note that #IPV6 is currently unsupported on AmigaOS and compatible systems.

#IPAUTO:
The host system hasn't decided on a protocol for this network object yet.

#IPUNKNOWN:
Network object uses an unknown protocol.

Inputs
id
connection object to query
type
optional: type of network object to query (defaults to #NETWORKCONNECTION)
Results
protocol
protocol of remote side of the connection

Show TOC