Re: Winsock client senddata
Your problem is here:
Code:
cmdConnect mtNetwork, mtUsername, mtPassword
cmdSend (Rs.Fields("TaskType1"))
cmdDisconnect
Winsock operates asynchronously, that means that control is passed back to your code immediately the SendData has been executed - not when it has actually sent the data - so you're closing the connection before it's had a chance to send the data.
You should use the Winsock_SendComplete event, which is triggered when the data has actually been sent, to close the socket.
Re: Winsock client senddata
You think something like this?
Code:
Public Sub cmdDisconnect()
If WinsockSendFinish = True Then
Winsock.Close
End If
If Winsock.State = sckClosed Then
WinsockSendFinish = False
End If
While Not WinsockSendFinish
DoEvents
Wend
End Sub
Public Sub cmdSend(tekst As String)
broj = 0
Winsock.SendData Chr(13) & Chr(10)
Winsock.SendData tekst & Chr(13) & Chr(10)
WinsockSendFinish = True
End Sub
In form_load I put WinsockSendFinish = False
...
And again I have the same problem :(
Re: Winsock client senddata
No, more like this:
Code:
Private boSent As Boolean
Private Sub Winsock_SendComplete()
boSent = True
End Sub
Public Sub cmdSend(tekst As String)
broj = 0
Winsock.SendData Chr(13) & Chr(10)
boSent = False
Winsock.SendData tekst & Chr(13) & Chr(10)
Do Until boSent = True
DoEvents
Loop
Winsock.Close
End Sub
Re: Winsock client senddata
Doogle,
thanks wery much for help!
I'am new in this... :rolleyes:
I replace code and try...
two times do command, and next time no :confused:
I just add to code
Code:
Public Sub cmdConfigurationSend()
Dim ConnectString As String
ConnectString = Chr$(IAC) & Chr$(DOTEL) & Chr$(ECHO) _
& Chr$(IAC) & Chr$(DOTEL) & Chr$(SGA) _
& Chr$(IAC) & Chr$(WILLTEL) & Chr$(NAWS) _
& Chr$(IAC) & Chr$(WILLTEL) & Chr$(TERMTYPE) _
& Chr$(IAC) & Chr$(WILLTEL) & Chr$(TERMSPEED)
If logovano = False Then Winsock.SendData ConnectString
End Sub
And put Sub after connect before login code.
That code I find in project of some Telnet...
If I understood well, this make vt100 terminal..
Now works!!! :thumb:
Thanks again!
Best regards, :wave:
cholegm