function
Library: TCP/IP client and server support (OMTCP legacy, OmniMark versions 6.0.2 - 7.0)
Include: omtcp.xin |
Returns: |
define external tcp-service function tcp-create-service at value integer PortNum optional queue-size value integer ListenQueueSize optional or define external tcp-service function tcp-create-service descriptor value integer ListenSocketDescriptor optional queue-size value integer ListenQueueSize optional
Argument definitions
Use tcp-create-service in a server program to create a TCP service port to listen on for incoming service requests.
You must include the following line at the beginning of your OmniMark program:
include "omtcp.xin"
You can specify either PortNum or the ListenSocketDescriptor, but not both (else external exception TCP22).
If ListenSocketDescriptor is specified it must be 0 or greater (else external exception TCP24).
If ListenQueueSize is specified it must be an integer from 1 to 1024 (else external exception TCP23).
The maximum ListenQueueSize is operating system dependent. If the maximum queue size for a socket on your operating system is less than the value specified for ListenQueueSize, no exception will be thrown.
If PortNum is specified a listening socket descriptor is created at the specified port.
If neither PortNum or ListenSocketDescriptor is specified an available port is chosen. You can discover the number of this port using the tcp-port function.
If ListenSocketDescriptor is specified it is assumed to be a valid listening socket. This means that a socket was created using an external function library function prior to calling to tcp-create-service.
local tcp-service DemoService set DemoService to tcp-create-service at 5600
local tcp-service DemoService local integer port set DemoService to tcp-create-service set port to tcp-port DemoService output "The selected service port for omdemo-service is %d(port)%n"