Click or drag to resize

CSocket.SendRawText Method

X#
Send any data to the connected socket.

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

Parameters

cData
Type: String
Pointer to the data to be sent via the socket.

Return Value

Type: Logic
TRUE if successful; otherwise, FALSE.
Remarks
SendRaw() sends raw data 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 the use of this method:
X#
 1FUNCTION ClientTest2()  AS LOGIC PASCAL
 2LOCAL oSocket   AS CSocket
 3LOCAL cTo       AS STRING
 4LOCAL cData     AS STRING
 5LOCAL nSize     AS INT
 6LOCAL nPort     AS INT
 7CLS
 8oSocket  := CSocket{SOCK_STREAM}
 9IF oSocket:connect( HostName(), 7)
10  cData := MemoRead("Test.txt")
11  nSize := SLen(cData)
12  IF oSocket:SendRaw(PTR(_CAST, cData), nSize)
13  oSocket:GetPeerName(@cTo, @nPort)
14         ? "Data sent to ", cTo, ", port: ", ;
15          NTrim(nPort)
16  ENDIF
17ENDIF
18oSocket:Close()
19RETURN
See Also