Click or drag to resize

CSocket.SendLine Method

X#
Send data terminated by CRLF to the connected socket.

Namespace:  VO
Assembly:  VOInternetClasses (in VOInternetClasses.dll) Version: 2.19
Syntax
 VIRTUAL METHOD SendLine(
	cData AS STRING
) AS LONG
Request Example View Source

Parameters

cData
Type: String
Data to be sent via the socket.

Return Value

Type: Long
Number of data sent, if successful; otherwise, 0 (zero).
Remarks
Method SendLine() sends a line to the connected socket.
Tip Tip
This method can be used for TCP sockets only, because it assumes that a connection is already established.
Examples
The following example demonstrates this method:
X#
 1FUNCTION ClientTest()   AS LOGIC PASCAL
 2LOCAL oSocket   AS CSocket
 3LOCAL cTo       AS STRING
 4LOCAL nPort     AS INT
 5oSocket  := CSocket{SOCK_STREAM}
 6IF oSocket:connect( HostName(), 7)
 7IF oSocket:SendLine("Hello world") > 0
 8oSocket:GetPeerName(@cTo, @nPort)
 9? "Data sent to ", cTo, ", port: ", NTrim(nPort)
10ENDIF
11oSocket:Close()
12ENDIF
13RETURN
See Also