Discussion in "Project Addition or Changes" started by    nvt8x    Jun 5, 2011.
Sun Jun 05 2011, 08:43 pm
#1
The first, thanks about your project. I used Telnet of window 7 and your project is good. I am writing a Client program by VB6. It don't run well. Line no down.
Private Sub About_Click()
MsgBox "Edited nvt8xm", vbInformation
End Sub

Private Sub ClCons_Click()
Text1.Text = ""
If Winsock1.State = 7 Then Exit Sub 'Winsock1.State = 7 trang thai van dang ket noi
Text2.Text = ""
End Sub

Private Sub CloseCon_Click()
Winsock1.Close
End Sub

Private Sub ExtCon_Click()
Form2.Show 1
End Sub

Private Sub Form_Load()
a = GetSetting("Telnetclient", "Last", "Server", "")
If a = "" Then
line3.Visible = False
LastConnection.Visible = False
Else
LastConnection.Caption = "1. " & a
End If
End Sub

Private Sub Form_Resize()
Text1.Width = Form1.Width - 375
Text2.Width = Form1.Width - 375
Text1.Height = Form1.Height - 1275
Text2.Top = Form1.Height - 1050
End Sub

Private Sub IndexHelp_Click()
'MsgBox "I will support later !", vbInformation
End Sub

Private Sub LastConnection_Click()
On Error GoTo 1
a = GetSetting("Telnetclient", "Last", "Server", "")
b = GetSetting("Telnetclient", "Last", "Port", 23)
Winsock1.Close
Winsock1.Connect a, b
Timer1.Enabled = True
Exit Sub
1 Winsock1.Close
MsgBox Err.Description, vbCritical
End Sub

Private Sub Quit_Click()
Unload Me
End Sub

Private Sub Text1_Change()
Text1.SelStart = Len(Text1.Text)
Text2.SetFocus
End Sub

Private Sub Text2_KeyDown(KeyCode As Integer, Shift As Integer)
KeyCode = 0
End Sub

Private Sub Text2_KeyPress(KeyAscii As Integer)
On Error GoTo 1
If KeyAscii = 13 Then 'KeyAscii = 13 =>
 Enter
Text2.Text = ""
Winsock1.SendData Chr(13) 'gui ky tu xuong duong
KeyAscii = 0
Else
Winsock1.SendData Chr(KeyAscii)
End If
Exit Sub
1 KeyAscii = 0 'khong cho phep nhap ky tu nao
End Sub

Private Sub Timer1_Timer()
Timer1.Enabled = False
Winsock1.Close
MsgBox "Unable to connect", vbCritical
End Sub

Private Sub Winsock1_Close()
Timer1.Enabled = False
MsgBox "Connection with host lost"
Me.Caption = "Telnet Client"
Winsock1.Close
End Sub

Private Sub Winsock1_Connect()
Me.Caption = "Telnet Client [" & Winsock1.RemoteHostIP & ":" & Winsock1.RemotePort & "]"
Timer1.Enabled = False
End Sub

Private Sub Winsock1_DataArrival(ByVal bytesTotal As Long)
Dim strData As String
Winsock1.GetData strData 'buffer$, vbString
Text1.Text = Text1.Text & strData
 'buffer$
End Sub




 DiGPCB like this.
Mon Jun 06 2011, 06:32 pm
#2
I suggest you to try it with 2 softwares... i.e. create or use a simple telnet server so that you can check communication between those two. once you get it working it will surely work with HA hardware.
Tue Jun 07 2011, 06:11 pm
#3
I ran it with Telnet program of Window 7. And it ran well. I tried add vbCrLr in "Private Sub Winsock1_DataArrival(ByVal bytesTotal As Long)". But result is down lines.
Please share Code Telnet Program of Window 7 by VB6.
Thanks!!!
Sun Jun 12 2011, 10:40 am
#4
the thing is your commands are not matching with what controller is expecting.
You can do packet sniffing using wireshark program to check what is being sent by telnet client of windows and match up with it. try to sniff packets on specific port only (the one u are using) so it will be easy for you to find out.

I do not have VB6 installed on my PC. I cannot check whether its working or not.
Sun Jun 12 2011, 10:41 am
#5

Get Social

Information

Powered by e107 Forum System

Downloads

Comments

Bobbyerilar
Thu Mar 28 2024, 08:08 am
pb58
Thu Mar 28 2024, 05:54 am
Clarazkafup
Thu Mar 28 2024, 02:24 am
Walterkic
Thu Mar 28 2024, 01:19 am
Davidusawn
Wed Mar 27 2024, 08:30 pm
Richardsop
Tue Mar 26 2024, 10:33 pm
Stevencog
Tue Mar 26 2024, 04:26 pm
Bernardwarge
Tue Mar 26 2024, 11:15 am