When I Enter the parameters required for ...
socket1.connect("10.0.1.125", 8080, 2000) The Socket_connected event is firimg, I know this as I have a Msgbox popup on sucessful connection.
However when I use variables in place of values as given below...
socket1.connect(IP, Portval, Tmout)
the socket_connected event fails, i receive no Msgbox popup.
The values IP, Portval are retrieved from a file stored as given here in a csv file...
Code in Activity create...
If File.Exists(File.DirInternal, "Config.csv") = True Then
Readconf.Extract
Socket1.Connect(IP,portval,tmout)
Else
pnlSettings.Visible = True
pnlControls.Visible = False
pnlHelp.Visible = False
End If
Readconf is a code module....
'Code module
'Subs in this code module will be accessible from all modules.
Sub Process_Globals
'These global variables will be declared once when the application starts.
'These variables can be accessed from all modules.
Dim sf As StringFunctions
Dim Readdata, chartest As String
Dim portvaltxt As String
Dim sbb As StringBuilder
Dim strlen, charpos, fieldstrt As Byte
End Sub
Sub Extract
sbb.Initialize
sf.Initialize
Readdata = File.ReadString(File.DirInternal, "Config.csv")
'Msgbox(Readdata, "The Current config")
strlen = sf.Len(Readdata)
For charpos = 1 To strlen
chartest = sf.Mid(Readdata, charpos, 1)
If chartest <> "," Then
sbb.Append(chartest)
Else
Exit
End If
Next
Main.ip = sbb
fieldstrt = charpos+ 1
portvaltxt = sf.Mid(Readdata, fieldstrt, (strlen-charpos))
Main.Portval = sf.Val(portvaltxt)
End
Using Msgbox have verified that the IP has a value as set in the file "config.csv" & the portval has a value too as extracted from "config.csv". Tmout = 2000 was initialized in the Process globals.
Why then is the Socket1_Connected failing when variables are passed, well actually this code was working with earlier versions of B4A, cant remember when this problem came up, frankly my working code was from early 2016.
Any quick update will be a great help.
Thanks in advance
socket1.connect("10.0.1.125", 8080, 2000) The Socket_connected event is firimg, I know this as I have a Msgbox popup on sucessful connection.
However when I use variables in place of values as given below...
socket1.connect(IP, Portval, Tmout)
the socket_connected event fails, i receive no Msgbox popup.
The values IP, Portval are retrieved from a file stored as given here in a csv file...
Code in Activity create...
If File.Exists(File.DirInternal, "Config.csv") = True Then
Readconf.Extract
Socket1.Connect(IP,portval,tmout)
Else
pnlSettings.Visible = True
pnlControls.Visible = False
pnlHelp.Visible = False
End If
Readconf is a code module....
'Code module
'Subs in this code module will be accessible from all modules.
Sub Process_Globals
'These global variables will be declared once when the application starts.
'These variables can be accessed from all modules.
Dim sf As StringFunctions
Dim Readdata, chartest As String
Dim portvaltxt As String
Dim sbb As StringBuilder
Dim strlen, charpos, fieldstrt As Byte
End Sub
Sub Extract
sbb.Initialize
sf.Initialize
Readdata = File.ReadString(File.DirInternal, "Config.csv")
'Msgbox(Readdata, "The Current config")
strlen = sf.Len(Readdata)
For charpos = 1 To strlen
chartest = sf.Mid(Readdata, charpos, 1)
If chartest <> "," Then
sbb.Append(chartest)
Else
Exit
End If
Next
Main.ip = sbb
fieldstrt = charpos+ 1
portvaltxt = sf.Mid(Readdata, fieldstrt, (strlen-charpos))
Main.Portval = sf.Val(portvaltxt)
End
Using Msgbox have verified that the IP has a value as set in the file "config.csv" & the portval has a value too as extracted from "config.csv". Tmout = 2000 was initialized in the Process globals.
Why then is the Socket1_Connected failing when variables are passed, well actually this code was working with earlier versions of B4A, cant remember when this problem came up, frankly my working code was from early 2016.
Any quick update will be a great help.
Thanks in advance