swirl
Guide to OmniMark 8   OmniMark home
docs home 
IndexConceptsTasksSyntaxLibrariesLegacy LibrariesErrors
 
  Related Syntax     Other Library Functions  
function  

tcp.accept-connection

 
 

Library: TCP/IP client and server support (OMTCP)
Import: omtcp.xmd
Return type: tcp-connection

Returns:


Declaration

define external tcp.connection function tcp.accept-connection
  from value    tcp.service    service

Argument definitions

service
is a previously created tcp.service object.


Purpose

Use tcp.accept-connection in a server program to accept incoming client-initiated service requests. The function returns a tcp.connection OMX component.

Requirements

service must have been previously created and must exist (else external exception TCP05).

Usage Notes

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.

Example #1

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.

  import "omtcp.xmd" prefixed by tcp.
  
  process
     local tcp.service omdemo-service
     local tcp.connection client
  
     set omdemo-service to tcp.create-service on 5600
  
     repeat
        set client to tcp.accept-connection from omdemo-service
        ;process request
     again

Example #2

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.

  import "omtcp.xmd" prefixed by tcp.
  process
     local tcp.connection client
  
     repeat
        set client to tcp.accept-connection from tcp.create-service on 5600
        ;process request
     again

    Related Syntax
   tcp.connection
   tcp.service
   tcp.port
   tcp.destroy-service
   tcp.create-service
 
  Other Library Functions
   tcp.accept-connection
   tcp.connect
   tcp.connection
   tcp.create-service
   tcp.destroy-service
   tcp.disconnect
   tcp.end-delimited
   tcp.get-string
   tcp.is-connected
   tcp.multi-packet
   tcp.omtcp-version
   tcp.peer-ip
   tcp.peer-name
   tcp.port
   tcp.put-string
   tcp.reader
   tcp.service
   tcp.set-buffering
   tcp.single-packet
   tcp.terminate-reader
   tcp.wait-for-input
   tcp.writer
 
 

Top [ INDEX ] [ CONCEPTS ] [ TASKS ] [ SYNTAX ] [ LIBRARIES ] [ LEGACY LIBRARIES ] [ ERRORS ]

OmniMark 8.2.0 Documentation Generated: March 13, 2008 at 3:27:39 pm
If you have any comments about this section of the documentation, please use this form.

Copyright © Stilo International plc, 1988-2008.