Back to product page

SendData method

Sends array of bytes to the user.




  • Basic
object.SendData Data, [ServiceIndex]    
The SendData(object,Data,ServiceIndex) syntax has these parts:
objectAn expression evaluating to an object of type SSHUser.
DataRequired. A Variant value. Byte array that holds data that should be sent to the user.
ServiceIndexOptional. A Variant value. Index of the service you're sending data to.


Unlike Sendmethod that sends string expression to the client, sometimes there's a need to send raw bytes to the client, as a part of some protocol you're implementing or similar. Since String variables are unhappy when holding raw binary data (although you can put binary data in String variables also), you should use this method for sending such data.

Following example sends 'WELCOME!' message to the client. Using

User.Send "WELCOME!" & VbCrLf

you would achieve the same result (sample in VB)

Private Sub wodSSHD1_ServiceStart(ByVal User As wodSSHDComLIB.ISSHUser, ByVal ServiceIndex As Long, ByVal ServiceType As wodSSHDComLIB.SSHServiceTypes, ByVal ServiceName As String)
Dim a(10) As Byte
  a(1) = Asc("W")
  a(2) = Asc("E")
  a(3) = Asc("L")
  a(4) = Asc("C")
  a(5) = Asc("O")
  a(6) = Asc("M")
  a(7) = Asc("E")
  a(8) = Asc("!")
  a(9) = 13
  a(10) = 10
  User.SendData a
End Sub