function
Library: TCP/IP client and server support (OMTCP legacy, OmniMark versions 4 - 6.0.1)
Include: omtcp.xin |
Returns: a TCPService object |
define external TCPService function TCPServiceOpen at value integer port-number optional descriptor value integer ListenSocketDescriptor optional queue-size value integer ListenQueueSize optional as "TCPServiceOpen"
A server program uses this function to create a TCP service port on which it will listen for incoming client-initiated service requests.
If TCPServiceOpen
fails, it still returns a TCP service object. This failure object is in error and is closed.
When using TCPServiceOpen, you can specify either the port-number or the listen-socket-descriptor, but not both.
TCPServiceGetPort
.
Argument:
Example 1:
local TCPService omdemo-service set omdemo-service to TCPServiceOpen at 5600
Example 2:
local TCPService omdemo-service local integer port set omdemo-service to TCPServiceOpen set port to TCPServiceGetPort omdemo-service output "The selected service port for omdemo-service is %d(port)%n"
Example 3:
local TCPService omdemo-service local integer ListenSocketFd set ListenSocketFd to Some_How_Get_Me_A_Listen_Socket_Descriptor_At_Port (6000) set omdemo-service to TCPServiceOpen descriptor ListenSocketFd