S streetfighter New Member Apr 3, 2017 #1 vb6 code to android converter first I tried to search for emulator to make the vb6 .exe file work on android, but I didn't find anyone I read about Converting VB6 to B4A so it can work on Android mobile, I installed B4A on my computer, and read this Tutorial https://www.b4x.com/android/forum/threads/converting-vb6-to-b4a.9347/ but I didn't understand anything so Please help me converting this code to Android, Code: Private Sub Form_Load() Dim strName As String strName = Winsock1.LocalIP txtIP = strName End Sub Code: Private Sub cmdConnect_Click() On Error Resume Next Winsock1.RemoteHost = txtIP.Text Winsock1.RemotePort = txtPort.Text Winsock1.Connect txtLog.ForeColor = &HC000& txtLog = "Connected" End Sub Code: Private Sub cmdClose_Click() Winsock1.Close txtLog = "Not Connected" & vbCrLf txtLog.ForeColor = &HFF& End Sub Code: Private Sub cmdSend_Click() On Error Resume Next Winsock1.SendData text1.Text & vbTab & text2.Text End Sub Code: Private Sub Winsock1_ConnectionRequest(ByVal requestID As Long) If Winsock1.State <> sckClose Then Winsock1.Close txtLog = "Not Connected" & vbCrLf txtLog.ForeColor = &HFF& End If Winsock1.Accept requestID txtLog = "Connected" & vbCrLf txtLog.ForeColor = &HC000& End Sub ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ because on computer will be the Host of the connection from mobile android this code will be in another project on the computer Code: Private Sub cmdHost_Click() On Error Resume Next Winsock1.LocalPort = txtPort.Text Winsock1.Listen End Sub Code: Private Sub Winsock1_DataArrival(ByVal bytesTotal As Long) Dim Data As String, Segments() As String Winsock1.GetData Data, vbString Segments = Split(Data, vbTab) Text1 = Segments(0) Text2 = Segments(1) End Sub Code: Private Sub Winsock1_ConnectionRequest(ByVal requestID As Long) If Winsock1.State <> sckClose Then Winsock1.Close txtLog = "Not Connected" & vbCrLf txtLog.ForeColor = &HFF& End If Winsock1.Accept requestID txtLog = "Connected" & vbCrLf txtLog.ForeColor = &HC000& End Sub Code: Private Sub cmdClose_Click() Winsock1.Close txtLog = "Not Connected" & vbCrLf txtLog.ForeColor = &HFF& End Sub Thanks
vb6 code to android converter first I tried to search for emulator to make the vb6 .exe file work on android, but I didn't find anyone I read about Converting VB6 to B4A so it can work on Android mobile, I installed B4A on my computer, and read this Tutorial https://www.b4x.com/android/forum/threads/converting-vb6-to-b4a.9347/ but I didn't understand anything so Please help me converting this code to Android, Code: Private Sub Form_Load() Dim strName As String strName = Winsock1.LocalIP txtIP = strName End Sub Code: Private Sub cmdConnect_Click() On Error Resume Next Winsock1.RemoteHost = txtIP.Text Winsock1.RemotePort = txtPort.Text Winsock1.Connect txtLog.ForeColor = &HC000& txtLog = "Connected" End Sub Code: Private Sub cmdClose_Click() Winsock1.Close txtLog = "Not Connected" & vbCrLf txtLog.ForeColor = &HFF& End Sub Code: Private Sub cmdSend_Click() On Error Resume Next Winsock1.SendData text1.Text & vbTab & text2.Text End Sub Code: Private Sub Winsock1_ConnectionRequest(ByVal requestID As Long) If Winsock1.State <> sckClose Then Winsock1.Close txtLog = "Not Connected" & vbCrLf txtLog.ForeColor = &HFF& End If Winsock1.Accept requestID txtLog = "Connected" & vbCrLf txtLog.ForeColor = &HC000& End Sub ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ because on computer will be the Host of the connection from mobile android this code will be in another project on the computer Code: Private Sub cmdHost_Click() On Error Resume Next Winsock1.LocalPort = txtPort.Text Winsock1.Listen End Sub Code: Private Sub Winsock1_DataArrival(ByVal bytesTotal As Long) Dim Data As String, Segments() As String Winsock1.GetData Data, vbString Segments = Split(Data, vbTab) Text1 = Segments(0) Text2 = Segments(1) End Sub Code: Private Sub Winsock1_ConnectionRequest(ByVal requestID As Long) If Winsock1.State <> sckClose Then Winsock1.Close txtLog = "Not Connected" & vbCrLf txtLog.ForeColor = &HFF& End If Winsock1.Accept requestID txtLog = "Connected" & vbCrLf txtLog.ForeColor = &HC000& End Sub Code: Private Sub cmdClose_Click() Winsock1.Close txtLog = "Not Connected" & vbCrLf txtLog.ForeColor = &HFF& End Sub Thanks
Erel B4X founder Staff member Licensed User Longtime User Apr 3, 2017 #2 You need to use ServerSocket + AsyncStreams. See this example: https://www.b4x.com/android/forum/threads/73792/#content And: https://www.b4x.com/search?query=AsyncStreams Upvote 0
You need to use ServerSocket + AsyncStreams. See this example: https://www.b4x.com/android/forum/threads/73792/#content And: https://www.b4x.com/search?query=AsyncStreams