laroberts Posted July 4, 2005 Posted July 4, 2005 I am doing a TelNet deal with VB.NET however I am having one issue, the user name and password is getting sent to fast. How can I slow it down or make the program wait for the telnet to ask me for the user name and then password? Code below: Private Sub TelnetGuiApp_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load m_Socket = New ASOCKETLib.SocketClass m_Constants = New Constants m_Socket.Protocol = m_Constants.asPROTOCOL_TELNET 'Host For FTP Location Dim TXT_HOST As String TXT_HOST = "library.uah.edu" m_Socket.Connect(TXT_HOST, 23) TXT_RESULT.Text = m_Socket.LastError.ToString() & " (" & m_Socket.GetErrorDescription(m_Socket.LastError) & ")" ' User Name For Host Dim TXT_COMMAND As String TXT_COMMAND = "guest" m_Socket.SendString(TXT_COMMAND, 1) TXT_RESULT.Text = m_Socket.LastError.ToString() & " (" & m_Socket.GetErrorDescription(m_Socket.LastError) & ")" ' Password For Host Dim TXT_PASSWORD As String TXT_PASSWORD = "5345" m_Socket.SendString(TXT_PASSWORD, 1) TXT_RESULT.Text = m_Socket.LastError.ToString() & " (" & m_Socket.GetErrorDescription(m_Socket.LastError) & ")" End Sub Quote
jmcilhinney Posted July 5, 2005 Posted July 5, 2005 Is there a synchronous function you can call on the socket that will wait for those requests to be received? Otherwise, you could just call Thread.Sleep to add your own delay, although hard coding a delay is not the most desirable method. Quote
laroberts Posted July 5, 2005 Author Posted July 5, 2005 Not sure Yeah I tried the thread method but that really did not work, I was thinking I could do some kind of timer or something but I am not sure how I would do it. Quote
jmcilhinney Posted July 5, 2005 Posted July 5, 2005 If you wanted to use a Timer you would have to put the code that sends the UserName and Password in a separate method that you could call from the Timer's Tick event handler. Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.