Click or drag to resize

CSocket.GetRawText Method

X#
Receive all available data from a socket.

Namespace:  VO
Assembly:  VOInternetClasses (in VOInternetClasses.dll) Version: 2.21
Syntax
 VIRTUAL METHOD GetRawText(
	 lLineMode AS LOGIC,
	 lNext AS LOGIC,
	 dwByteCount AS DWORD
) AS STRING
Request Example View Source

Parameters

lLineMode
Type: Logic
** missing parameter documentation **
lNext
Type: Logic
** missing parameter documentation **
dwByteCount
Type: DWord
** missing parameter documentation **

Return Value

Type: String
String containing the received data, if successful; otherwise, NULL_STRING.
Remarks
This method stores input data to a string.
Tip Tip
GetRaw() can be used for TCP sockets only, because it assumes that a connection is already established.
Examples
The following example implements a simple socket server function waiting for connection at port 7 and receiving all data from the client:
X#
 1FUNCTION ServerTest3()   AS VOID PASCAL
 2LOCAL oSocket   AS CSocket
 3LOCAL oSockMsg  AS CSocket
 4LOCAL cData     AS STRING
 5LOCAL cFrom     AS STRING
 6LOCAL nPort     AS INT
 7oSocket  := CSocket{SOCK_STREAM}
 8IF oSocket:bind(7, NULL_STRING, AF_INET)
 9  oSocket:listen(1)
10  oSockMsg := oSocket:accept()
11  IF oSockMsg != NULL_OBJECT
12         cData := oSockMsg:GetRaw()
13  oSockMsg:GetPeerName(@cFrom, @nPort)
14  ? "Data received from ", cFrom, ;
15  ", Client     port: ", NTrim(nPort)
16  ? "Received data: ", cData
17  ENDIF
18  oSockMsg:Close()
19ENDIF
20oSocket:Close()
21RETURN
See Also