beautypg.com

10 setsockopt% function – Rockwell Automation 57C610 Enhanced Basic Language, AutoMax User Manual

Page 119

background image

8Ć9

8.10

SETSOCKOPT% Function

Format:

SETSOCKOPT%( sn%, opnum%, opval% )

where:

sn%

is the number of socket whose option you want to

set.

opnum%

is the number of the option to set.

opval%

is the value to write into the ENI.

This function is used to select different modes of operation.

OPNUM% selects which option to change, and OPVAL% selects the

mode of operation.
Options

OPNUM% OPVAL% Description

Keep Alive

0008h

0

Keep alive is disabled

ăă(Default)

1

Keep alive is enabled

This option is only used on TCP sockets. When enabled, the ENI will

periodically send an empty message to maintain the connection. If

this option is not used and a frame is not received within 8 minutes

the ENI will assume it has been broken.
Linger

0080h

0

Linger is disabled (Default)

1

Linger is enabled

This option is only used on TCP sockets to select how the

SHUTDOWN function will operate. When linger is enabled and there

are messages in any transmit or receive queues the ENI will process

those messages before doing the shutdown.
Non Blocking 0200h

0

Non Blocking is disabled

ăă(Default)

1

Non Blocking is enabled

This option is used to select how the RECV% and RECVL% function

will operate. If Non blocking is enabled and no message has arrived

for the RECV% or RECVL%, control is returned to the application

program and an error code Ć101 is returned by the RECV% or

RECVL%.
Values Returned:
ă1

Success

-2

ENI not initialized

-5

Did not set option

-9

No buffer space

-15 Bad socket number

-20 Bad option number

-21 Bad option value
For example, to set the socket to nonblocking:

STATUS% = SETSOCKOPT%( SN%, 0200h, 1 )

This manual is related to the following products: