|
|
Write data to the remote host.
Syntax
object.Write( Buffer [, Length]
)
Remarks
The Write method sends the data in buffer to the
remote host. If the connection is buffered, as is typically the
case, the data is copied to the send buffer and control immediately
returns to the program. If the control is blocking, the application
will wait until the data can be sent. If the control is
non-blocking and the write fails because it could not send all of
the data to the server, the OnWrite event will be fired when
the server can accept data again.
- Buffer
- A buffer variable that contains the data to be written to the
server. If the variable is a String then the data will be written
as a string of characters. This is the most appropriate data type
to use if the remote host expects text data that consists of
printable characters. If the remote host is expecting binary data,
it is recommended that a Byte array be used instead.
- Length
- A numeric argument which specifies the number of bytes to
write. Its maximum value is 231-1 = 2147483647. If a
value is specified for this argument and it is greater than the
actual size of the buffer, then the Length argument will be
ignored and the entire contents of the buffer will be written. If
the argument is omitted, then the maximum number of bytes to write
is determined by the size of the buffer.
Return Value
This method returns the number of bytes actually written to the
server, or -1 if an error was encountered.
See Also
Connected Property,
IsWritable Property,
Timeout Property, Read Method, SendKey
Method, OnWrite Event
|
|