function
Library: TCP/IP client and server support (OMTCP legacy, OmniMark versions 6.0.2 - 7.0)
Include: omtcp.xin |
Returns: |
define external tcp-connection function tcp-accept-connection value tcp-service service
Argument definitions
Use tcp-accept-connection in a server program to accept incoming client-initiated service requests. The function returns a tcp-connection OMX component.
You must include the following line at the beginning of your OmniMark program:
include "omtcp.xin"
service must have been previously created and must exist (else external exception TCP05).
External exception TCP10 is thrown if an error occurs while the connection request is being accepted. The message supplied with the exception contains the error code from the operating system for the error that occurred.
In this example a variable of type tcp-service was declared. For the service to be destroyed the variable must either go out of scope or be explicitly destroyed with tcp-destroy-service.
local tcp-service omdemo-service local tcp-connection client set omdemo-service to tcp-create-service at 5600 repeat set client to tcp-accept-connection omdemo-service ;process request again
In this example no tcp-service type variable was declared. The only way for the service to be destroyed is for the service to go out of scope.
local tcp-connection client repeat set client to tcp-accept-connection tcp-create-service at 5600 ;process request again