Using the subs below, I am connecting to a weigh scale controller thru an AP from my app.
All works great. I get the weight value with no problem.
However, if a device is already connected to the scale controller, another attempt by another device will cause the "Successful" of Scalecontroller_Connected to return false. The second connection must enter the weight thru an input form since it can't get the weight automatically.
It seems to me the port (10001) can only handle one connection at a time..
Is this true - or any way to allow multiple connections?
Thanks
All works great. I get the weight value with no problem.
However, if a device is already connected to the scale controller, another attempt by another device will cause the "Successful" of Scalecontroller_Connected to return false. The second connection must enter the weight thru an input form since it can't get the weight automatically.
It seems to me the port (10001) can only handle one connection at a time..
Is this true - or any way to allow multiple connections?
Thanks
B4X:
Sub StartScale
SetIPAddress ' set the ip for ScaleIP
sock.Initialize("Scalecontroller")
' sock.Connect("10.131.199.50", 10001, 10000) - for testing
sock.Connect(ScaleIP, 10001, 20000)
' sock.Connect(IP, port number, time out in ms)
' ToastMessageShow(" Connecting to Scale Controller... ",False)
End Sub
Sub Scalecontroller_Connected (Successful As Boolean)
Log($"Scalecontroller_Connected: (${Successful})"$)
If Successful Then
AStreams.Initialize( sock.InputStream, Null, "Scale")
Else
ToastMessageShow(" Connection to Scale Controller Failed! ",True)
SetWeight
End If
End Sub