CSocket.SendLine Method | |
Send data terminated by CRLF to the connected socket.
Namespace:
VO
Assembly:
VOInternetClasses (in VOInternetClasses.dll) Version: 2.21
Syntax VIRTUAL METHOD SendLine(
cData AS STRING
) AS LONG
public virtual int SendLine(
string cData
)
Request Example
View SourceParameters
- 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 |
---|
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:
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