I’m using VB6 and Chillcat Socket component. when I send first /login i got this response
!fatal
not logged in
Private Sub Form_Load()
Dim socket As New ChilkatSocket
Dim success As Long
success = socket.UnlockComponent(“Anything for 30-day trial”)
If (success <> 1) Then
MsgBox “Failed to unlock component”
Exit Sub
End If
’ Connect to the program at some host:port that is expecting
’ to receive the file. In this case, the receiver is at
’ localhost:5555
Dim ssl As Long
ssl = 0
Dim maxWaitMillisec As Long
maxWaitMillisec = 1000
'socket.StringCharset = “ascii”
success = socket.Connect(“192.168.254.1”, 8728, ssl, maxWaitMillisec)
If (success <> 1) Then
MsgBox socket.LastErrorText
Exit Sub
End If
'Set maximum timeouts for reading an writing (in millisec)
socket.MaxReadIdleMs = 1000
socket.MaxSendIdleMs = 1000
’ Send the byte count:
success = socket.SendCount(LenB(“/login”))
If (success <> 1) Then
MsgBox socket.LastErrorText
Exit Sub
End If
’ Send the file data.
success = socket.SendBytes(“/login”)
If (success <> 1) Then
MsgBox socket.LastErrorText
Exit Sub
End If
DoEvents
’ Send zero character
success = socket.SendString(0)
If (success <> 1) Then
MsgBox socket.LastErrorText
Exit Sub
End If
While checking something else, I found a potential problem.
success = socket.SendCount(LenB(“/login”))
SendCount sends a 4 byte (integer) value. You only want to send one byte in this case. Should be Chr(7).
You might want to check if the ChillKat SendString() routine sends the terminating zero.
ADD:I think I would try this:
success = socket.SendString(Chr(7) & "/login")
No other send. No SendCount or SendBytes. I have a feeling that the difference between SendBytes and SendString would be the terminating zero character. What do you think? Worth a try?
EDIT: I think maybe the value should be Chr(6). Now that I think about it more, the last character is sent by itself (zero) denoting “no characters remaining”, or “end”. I don’t have my Java code here to check.