I am getting this error:
when the AStreams_Initialize() function is called in this function block.
(I removed unnecessary code for clarity.)
The socket opens with success = TRUE, yet a couple lines of code below, ASreams_Initailize() fails because the socket is closed?
The strange part is that this code worked a little while ago, and I have not made purposeful changes to the way the socket is opened. I have a similar app that works fine on the same machine that uses a lot of the same code, talking to the same target.
At the moment, I am not specifically looking for a fix to this, just some guidance as to what could cause that kind of problem (tcp_Connected( ) is True but tcp socket is closed). The app is pretty big and without the target that this is intended to communicate with, it's won't be very useful to post it.
Thanks for any insight.
*** Service (starter) Create ***
** Service (starter) Start **
** Activity (main) Create, isFirst = true **
** Activity (main) Resume **
Error occurred on line: 345 (Starter)
java.net.SocketException: Socket is not connected
at java.net.Socket.getInputStream(Socket.java:937)
at anywheresoftware.b4a.objects.SocketWrapper.getInputStream(SocketWrapper.java:239)
at b4a.sabus.starter._tcpsck1_connected(starter.java:1077)
at java.lang.reflect.Method.invoke(Native Method)
at anywheresoftware.b4a.shell.Shell.runMethod(Shell.java:732)
at anywheresoftware.b4a.shell.Shell.raiseEventImpl(Shell.java:351)
at anywheresoftware.b4a.shell.Shell.raiseEvent(Shell.java:255)
at java.lang.reflect.Method.invoke(Native Method)
at anywheresoftware.b4a.ShellBA.raiseEvent2(ShellBA.java:144)
at anywheresoftware.b4a.BA$2.run(BA.java:387)
at android.os.Handler.handleCallback(Handler.java:938)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:223)
at android.app.ActivityThread.main(ActivityThread.java:7656)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:592)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:947)
when the AStreams_Initialize() function is called in this function block.
B4X:
Sub TCPSck1_Connected( success As Boolean )
'If TCPSck1.Connected = True Then
If success Then
If AStreams.IsInitialized = False Then
AStreams.Initialize( TCPSck1.InputStream, TCPSck1.OutputStream, "Astreams" )
End If
End If
End Sub
(I removed unnecessary code for clarity.)
The socket opens with success = TRUE, yet a couple lines of code below, ASreams_Initailize() fails because the socket is closed?
The strange part is that this code worked a little while ago, and I have not made purposeful changes to the way the socket is opened. I have a similar app that works fine on the same machine that uses a lot of the same code, talking to the same target.
At the moment, I am not specifically looking for a fix to this, just some guidance as to what could cause that kind of problem (tcp_Connected( ) is True but tcp socket is closed). The app is pretty big and without the target that this is intended to communicate with, it's won't be very useful to post it.
Thanks for any insight.