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

tcp-connect

 
 

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

Declaration

  define external tcp-connection function tcp-connect
         on value stream HostName
         at value integer PortNum
    timeout value integer ms 	(optional)

Argument definitions

HostName
is the name or IP address of the host to be connected to.
PortNum
is the port to be connected to.
ms
is how long the function will attempt to make connection before aborting, expressed in milliseconds.


Purpose

Use tcp-connect in a client program to establish a connection to a server program that is running on a specific host machine and port.

Requirements

You must include the following line at the beginning of your OmniMark program:

  include "omtcp.xin"

The address supplied for HostName must be valid (else external exception TCP01).

The port number must fall between 0 and 65535 (else external exception TCP14).

Usage

If the connection cannot be made for any reason, the function throws external exception TCP08.

If the timeout value is specified it applies only to the wait for the connection. If the timeout is exceeded, the connection fails.

If the timeout is not specified, tcp-connect "blocks" until a connection is made or some other cause of failure is encountered.

Example


  local tcp-connection client

  set client to tcp-connect on "123.123.123.45" at 5600

        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:50 pm
If you have any comments about this section of the documentation, send email to [email protected]

Copyright © Stilo Corporation, 1988-2005.