Command group Flag affected Reversible Execute on client Platform(s)
External commands YES NO NO All


TCPGetMyPort (socket) Returns port


Note: The flag is set according to whether Omnis was able to make a call to this external command.

This Web command is multi-threaded, allowing another thread to execute in the multi-threaded server while it runs. Note that the same socket cannot safely be used concurrently by more than one thread.

TCPGetMyPort is a command to return the number of the local TCP/IP port to which a given socket is bound.

Socket is an Omnis Long Integer field containing a connected socket, or a socket bound to a port.

Port is an Omnis Long Integer field which receives the port number, or an error code < 0. Possible error codes are listed in the Web Command Error Codes Appendix.


; Bind iPort to iSocket and use TCPGetMyPort to return the
; port to which iSocket is bound in lMyPort.
Calculate iPort as 6000
TCPSocket Returns iSocket
TCPBind (iSocket,iPort) Returns lStatus
TCPGetMyPort (iSocket) Returns lMyPort
TCPClose (iSocket) Returns lStatus