Send (Socket function)

From m204wiki
Revision as of 19:04, 11 June 2012 by JAL2 (talk | contribs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

Send a string over this socket (Socket class)


This callable method sends a string over a Janus Sockets connection. The Send function has an effect similar to $Sock_Send.

Syntax

[%number =] socket:Send( string, [[Options=] string])

Syntax terms

%number This is a numeric variable to contain the returned indicator of success of the function.

The return value is either of these:

0 The function completed successfully.
-1 The socket is not open, and ONRESET CONTINUE is in effect for the socket.
socket A variable or an expression that is a reference to a Socket object.
string The string to send.
Options This optional argument is an option string that may contain any

of the following:

BINARY Regardless of whether the BINARY or CHAR parameter is in effect for the socket's port, data is not translated when sent. The argument can be the result of a previous translation using the TranOut method.
CHAR Regardless of whether the BINARY or CHAR parameter is in effect for the socket's port, data is translated when sent. The translation is specified by the output table defined by the socket's XTAB parameter.
FIN After string is sent, no more data will be sent on the socket. This transmits the FIN indication to the remote partner.

Note that when FIN is sent, print capturing is automatically turned OFF for the socket.

PUSH Ensures that the data being sent on the socket is immediately sent to the receiver. Normally, data to be sent is buffered and may not be sent immediately.

Using PUSH is not necessary if:

  • You are specifying FIN, since a push operation is implied by FIN.
  • You are alternating sends and receives on a socket, since receive-processing methods (ReceiveReceive and ReceiveAndParse) always do a push before receiving.

Usage notes

  • If you need to send line-end delimited information, use the SendWithLineEnd method.

See also