swirl
Guide to OmniMark 7   OmniMark home
docs home 
IndexConceptsTasksSyntaxLibrariesLegacy LibrariesErrors
 
      Other Library Functions  
function  

tcp-create-service

 
 

Library: TCP/IP client and server support (OMTCP) legacy
Include: omtcp.xin
Return type: tcp-service
Returns: 

Declaration

  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

PortNum
is the port the service is to be created on.
ListenSocketDescriptor
is a file descriptor for an already created socket.
ListenQueueSize
is the number of connection requests that will be queued for acceptance. The default value is 5.


Purpose

Use tcp-create-service in a server program to create a TCP service port to listen on for incoming service requests.

Requirements

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).

Usage Notes

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.

Example #1


  local tcp-service DemoService

  set DemoService to tcp-create-service at 5600

Example #2


  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"

        Other Library Functions
   tcp-accept-connection
   tcp-connect
   tcp-connection
   tcp-create-service
   tcp-destroy-service
   tcp-disconnect
   tcp-get
   tcp-has-characters
   tcp-is-connected
   tcp-is-version-compatible
   tcp-library-version
   tcp-peer-ip
   tcp-peer-name
   tcp-port
   tcp-put
   tcp-service
   tcp-set-buffering
   tcp-signal-source-end
   tcp-sink
   tcp-source
 
 

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

OmniMark 7.1.2 Documentation Generated: June 28, 2005 at 5:45:52 pm
If you have any comments about this section of the documentation, send email to [email protected]

Copyright © Stilo Corporation, 1988-2005.