Skip to content

_port_open

bergsma edited this page Sep 26, 2014 · 3 revisions

#port_open

###Open a port.

Syntax

socket = port_open ( targer,modifier ) ;

Arguments

  1. str targer

The target for the SECS II connection. There are 2 types of connections. TCP/IP: the target will be a DNS host name/an IP address. Serial: the target will be a str value, like "com1:" or "/dev/ttyS0"

  1. list modifier

This is the baud rate if the connection is over a serial connection (300, 1200, 2400, 4800, 9600, 19200, etc). This is the port number for TCP/IP connections.

Return Value

handle socket
  • socketHandle : The socket handle for the open connection.

The STATUS variable is set to $ACKNOWLEDGE

  • -1 : Failed to open port. (for serial connections).

The STATUS variable is set to %PORT

  • -1 : Failed to connect to service at node 'x' on port 'y' (for TCP/IP connections).

The STATUS variable is set to %PORT

  • -1 : One of the arguments was out of boumds.

The STATUS variable is set to %BOUNDS

  • -1 : 'target' is not a tty device (for serial connections)

The STATUS variable is set to %IO

Warnings

  • %PORT : Failed to open port. (for serial connections).
  • %PORT : Failed to connect to service at node 'x' on port 'y' (for TCP/IP connections).
  • %BOUNDS : One of the arguments was out of boumds.
  • %IO : 'target' is not a tty device (for serial connections)

Exceptions

  • %ARGUMENT: Invalid arguments. Usage: socket = port_open ( targer,modifier ) ;

Description

  • None

Examples

puts "Create an example for the function 'port_open'" ;

Related Links

None

Clone this wiki locally