Set (Socket function): Difference between revisions
m (→Syntax terms) |
m (→Syntax terms) |
||
(2 intermediate revisions by the same user not shown) | |||
Line 19: | Line 19: | ||
<td>A variable or an expression that is a reference to a <var>Socket</var> object.</td></tr> | <td>A variable or an expression that is a reference to a <var>Socket</var> object.</td></tr> | ||
<tr><th>keyword</th> | <tr><th>keyword</th> | ||
<td>Any of the keywords from the | <td>Any of the keywords from the keyword list provided below. Some of these keywords require that the socket be <var>OPEN</var> for the setting to take effect; for these, if the socket is not <var>OPEN</var>, the operation is ignored.</td></tr> | ||
<tr><th>value</th> | <tr><th>value</th> | ||
<td>The value the parameter | <td>The value to which the keyword parameter should be set. If the keyword is self-defining, this argument may be omitted or left null. Valid values are explained in the keyword list provided below. | ||
<table> | <table> | ||
<tr><th>Keyword</th> <th>Meaning </th></tr> | <tr><th>Keyword</th> <th>Meaning </th></tr> | ||
Line 75: | Line 75: | ||
</ul> | </ul> | ||
The default is taken from the socket's port definition (see <var>[[PRSTOK]]</var>). This requires that the socket be <var>OPEN</var>. </td></tr> | The default is taken from the socket's port definition (see <var>[[PRSTOK]]</var>). This requires that the socket be <var>OPEN</var>. </td></tr> | ||
<tr><th><var>RECVLIM </var></th> | <tr><th><div id="recvlim"></div><var>RECVLIM </var></th> | ||
<td>A number ranging from 0 to 2,147,483,647, specifying the limit on total bytes of data plus "parse tokens" scanned by subsequent receive operations. The default is 0, indicating no limit. | <td>A number ranging from 0 to 2,147,483,647, specifying the limit on total bytes of data plus "parse tokens" scanned by subsequent receive operations. The default is 0, indicating no limit. | ||
<var>RECVLIM</var> is discussed in [[ | <var>RECVLIM</var> is discussed in [[Receive (Socket function)#Lengths: maximum, minimum, truncation, RECVLIM|"Lengths: maximum, minimum, truncation, RECVLIM"]] and [[ReceiveAndParse (Socket function)#Lengths: maximum, truncation, RECVLIM|"Lengths: maximum, truncation, RECVLIM"]]. | ||
This requires that the socket be <var>OPEN</var>. </td></tr> <tr><th><var>TIMEOUT</var></th> <td>Number indicating the port <var>[[TIMEOUT]]</var> time, in seconds. | This requires that the socket be <var>OPEN</var>. </td></tr> <tr><th><var>TIMEOUT</var></th> <td>Number indicating the port <var>[[TIMEOUT]]</var> time, in seconds. | ||
The default is taken from the socket's port definition. This requires that the socket be <var>OPEN</var>. </td></tr> <tr><th><var>XTAB</var></th> | The default is taken from the socket's port definition. This requires that the socket be <var>OPEN</var>. </td></tr> <tr><th><var>XTAB</var></th> |
Latest revision as of 22:26, 7 June 2012
Change a setting for this socket (Socket class)
This method changes the value of a parameter or setting on the indicated socket.
The Set function, which may be invoked with a Call statement,
has an effect similar to $Sock_Set.
Syntax
[%string =] socket:Set( keyword, [value])
Syntax terms
%string | If specified, string that is to contain either:
| ||||||||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
socket | A variable or an expression that is a reference to a Socket object. | ||||||||||||||||||||||||||||||||||||
keyword | Any of the keywords from the keyword list provided below. Some of these keywords require that the socket be OPEN for the setting to take effect; for these, if the socket is not OPEN, the operation is ignored. | ||||||||||||||||||||||||||||||||||||
value | The value to which the keyword parameter should be set. If the keyword is self-defining, this argument may be omitted or left null. Valid values are explained in the keyword list provided below.
|
Usage notes
- The Set method differs from $Sock_Set as follows:
- $Sock_Set may optionally be applied to "all relevant single sockets," but the Set method applies only to a single Socket object.
- As of version 6.6, the CLOSE and NOCLOSE keywords are not valid options for the Set method. Since Socket objects may persist (Global or Session) beyond a request, and since they are also subject to discard, it is whether or not the object has been discarded that determines whether the socket gets closed at the end of the request.
- If the Set method is invoked for a socket
that is RESET, the results depend on several factors:
- If the keyword argument is
ONRESET
, the operation is performed normally, and there is no indication of the fact that the socket is RESET. - Otherwise, if the keyword argument
is one which does not require an
OPEN socket, and
ONRESET CONTINUE
,CANCELC
, orLABELC
is in effect for the socket, the stringRESET
is returned, and the last error information is set. - Otherwise, if
ONRESET CONTINUE
is in effect for the socket, the stringRESET
is returned, and the last error information is set. - Otherwise, the request is canceled or the ONRESET label is jumped to, as explained in "Handling connection errors and RESET sockets".
- If the keyword argument is
- The keyword argument can be omitted for keywords that are self-defining:
%t = %sock:Set('BINARY')
This sets the socket to binary mode, in which bytes sent over the connection are not translated in any way. "Self-defining" keywords can also be accompanied by a value argument, which allows you to restore a previous value:
FOO: Subroutine %t = %sock:Set('BINARY') ... %t = %sock:Set('BINARY', %t) Return
The value argument is required for keywords that need a value:
%t = %sock:Set('LINEND', 'NONE')
This disables the sending of the line-end string.
- You can use the Info method to obtain the current value of the setting of any of the keywords that can be specified as the keyword argument of the Set method.