Telnet Object : Send Method |
Visual Basic |
---|
Public Function Send( _ ByRef Data As Variant, _ Optional ByVal LimitCount As Long = 0 _ ) As Long |
You can use this method only when the State property is tcpConnected; otherwise, a ptNotConnected error is generated.
Data can be provided in two ways:
If LimitCount is specified and is greater than 0, then the number of bytes sent is limited to LimitCount. For example, if a Byte array of length 8192 contains only 100 bytes that the user wants to send, then a LimitCount of 100 can be used to override the default behavior, which would be to send the entire 8192 bytes (the length of the array).
This method can be invoked as blocking or non-blocking, depending on the value of the Timeout property. When performing blocked method calls, the Blocked property may be checked to verify the control is not busy executing another method. If the Timeout property is positive, this method blocks until the system accepts the data for sending (the SendBufferCount property decrements to 0) or the timeout period expires.
Any IAC character (ASCII 255) is doubled up according to the protocol specification. Any CR character (ASCII 13) not followed by a LF character (ASCII 10) has a NULL inserted after it according to the protocol specification. The reciprocal operation is applied to received data. The user should use CR/LF (ASCII 13 and ASCII 10) to terminate each line.
Error Codes
The Send method may generate the following error codes (refer to the ErrorConstants topic for a complete list of error codes):