Click or drag to resize

CSocket.SendLineTo Method

X#
Send data terminated by CRLF to a specific destination.

Namespace:  VO
Assembly:  VOInternetClasses (in VOInternetClasses.dll) Version: 2.19
Syntax
 VIRTUAL METHOD SendLineTo(
	cData AS STRING,
	cDest AS STRING,
	nRemPort AS WORD
) AS LONG
Request Example View Source

Parameters

cData
Type: String
Data to be sent via the socket.
cDest
Type: String
String containing the host name of an Internet server. Alternately, the string can contain the IP number of the site in ASCII dotted-decimal format (for example, 11.22.3.45).
nRemPort
Type: Word
Port number at cHostNameOrIP.

Return Value

Type: Long
Number of data sent, if successful; otherwise, 0 (zero).
Remarks
This method sends a line to a destination without establishing a connection. SendLine() can be used for UDP sockets to send datagram packages via the Internet.
Examples
The following example demonstrates the use of this method:
X#
 1FUNCTION ClientTest1()   AS LOGIC PASCAL
 2LOCAL oSocket   AS CSocket
 3LOCAL cTo       AS STRING
 4LOCAL nPort     AS INT
 5oSocket  := CSocket{SOCK_DGRAM}
 6IF oSocket:SendLineTo("Hello world", HostName(), 7)
 7? "Datagram package sent ... "
 8ENDIF
 9oSocket:Close()
10RETURN
See Also