netTCPStreamPort

Returns the port number of the remote peer in a TCP connection. Takes a handle (Int). Returns the peer's port number, or 0 if invalid (Int).

Network

Parameters & Returns

Parameters

handle Int

Returns

Int

Quick Summary

Returns the port number of the remote peer in a TCP connection. Takes a handle (Int). Returns the peer's port number, or 0 if invalid (Int).

Technical Exegesis...

Retrieves the port number of the connected peer (remote endpoint) for the specified TCP stream. Returns the port number, or 0 if the handle is invalid or getpeername fails.

Uses getpeername to query the peer address and ntohs to convert from network to host byte order. For client connections (netOpenTCPStream), returns the server's port. For accepted connections (netAcceptTCPStream), returns the client's port. Useful for logging connections or identifying services.

Example

Example.bam
; No example implemented yet