Android Question Crash, java.net.SocketException: Socket closed

mw71

Active Member
Licensed User
Longtime User
Hi

in DebugMode i have a Crash:

java.lang.RuntimeException: java.net.SocketException: Socket closed
at anywheresoftware.b4a.ShellBA.raiseEvent2(ShellBA.java:170)
at anywheresoftware.b4a.BA.raiseEvent2(BA.java:170)
at anywheresoftware.b4a.BA.raiseEvent(BA.java:166)
at anywheresoftware.b4a.objects.ViewWrapper$1.onClick(ViewWrapper.java:78)
at android.view.View.performClick(View.java:5246)
at android.widget.TextView.performClick(TextView.java:10626)
at android.view.View$PerformClick.run(View.java:21256)
at android.os.Handler.handleCallback(Handler.java:739)
at android.os.Handler.dispatchMessage(Handler.java:95)
at android.os.Looper.loop(Looper.java:145)
at android.app.ActivityThread.main(ActivityThread.java:6939)
at java.lang.reflect.Method.invoke(Native Method)
at java.lang.reflect.Method.invoke(Method.java:372)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1404)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1199)
Caused by: java.net.SocketException: Socket closed
at libcore.io.Posix.recvfromBytes(Native Method)
at libcore.io.Posix.recvfrom(Posix.java:185)
at libcore.io.BlockGuardOs.recvfrom(BlockGuardOs.java:250)
at libcore.io.IoBridge.recvfrom(IoBridge.java:553)
at java.net.PlainSocketImpl.read(PlainSocketImpl.java:485)
at java.net.PlainSocketImpl.access$000(PlainSocketImpl.java:37)
at java.net.PlainSocketImpl$PlainSocketInputStream.read(PlainSocketImpl.java:237)


I show a Custom Dialog with Labels and Radio Buttons:

B4X:
    Dim pnl_Up As Panel
    Dim pnl, pnl_exp, pnl_Port As Panel
    Dim lbl_exp_ref, lbl_exp_Port As Label
    Dim rbtn_Ref_ja, rbtn_Ref_nein, rbtn_Port_ja, rbtn_Port_nein As RadioButton
    Dim ret As Int


        pnl.Initialize("pnl")
        pnl_exp.Initialize("pnl_exp")
        pnl_Port.Initialize("pnl_port")

        lbl_exp_ref.Initialize(""):    lbl_exp_Port.Initialize("")
        rbtn_Ref_ja.Initialize("rbtn_Ref"):    rbtn_Ref_nein.Initialize("rbtn_Ref")
        rbtn_Port_ja.Initialize("rbtn_Port"):rbtn_Port_nein.Initialize("rbtn_Port")
        pnl_exp.AddView(lbl_exp_ref,10dip,5dip,80%x,90dip)
        pnl_exp.AddView(rbtn_Ref_ja,10dip,80dip,60dip,40dip)
        pnl_exp.AddView(rbtn_Ref_nein,90dip,80dip,80dip,40dip)
        pnl_Port.AddView(lbl_exp_Port,10dip,5dip,80%x,90dip)
        pnl_Port.AddView(rbtn_Port_ja,10dip,80dip,60dip,40dip)
        pnl_Port.AddView(rbtn_Port_nein,90dip,80dip,80dip,40dip)
        pnl.AddView(pnl_exp,0dip,0dip,100%x,100%y)
        pnl.AddView(pnl_Port,0dip,120dip,100%x,100%y)
   
        lbl_exp_ref.Text=Starter.loc.Localize("txt_GMA_Exp_F")
        lbl_exp_Port.Text=Starter.loc.Localize("txt_GMA_Exp_P")
        rbtn_Ref_ja.Text=Starter.loc.Localize("txt_ja")
        rbtn_Ref_nein.Text=Starter.loc.Localize("txt_nein")
        rbtn_Port_ja.Text=Starter.loc.Localize("txt_ja")
        rbtn_Port_nein.Text=Starter.loc.Localize("txt_nein")
   
        lbl_exp_ref.TextSize=18:    lbl_exp_Port.TextSize=18
        rbtn_Ref_ja.TextSize=18:    rbtn_Ref_nein.TextSize=18
        rbtn_Port_ja.TextSize=18:    rbtn_Port_nein.TextSize=18

        Dim hoehe As Int=pnl_Port.Top + lbl_exp_Port.Height + rbtn_Port_ja.Height + rbtn_Port_nein.Height
        cd.AddView(pnl,0dip,0dip,90%x,hoehe)
        varGMA_Exp_Show=True

        Do While rbtn_check < 2
            rbtn_check=0       
            ret=cd.Show("GMA Export","",Starter.loc.Localize("txt_start"),"Cancle",Null) 'Positiv,Cancel, Negativ
            If ret=DialogResponse.NEGATIVE Then Exit
            If rbtn_Port_ja.Checked=True Or rbtn_Port_nein.Checked=True Then rbtn_check=1
            If rbtn_Ref_ja.Checked=True Or rbtn_Ref_nein.Checked=True Then rbtn_check=rbtn_check+1
            If rbtn_check<2 Then Msgbox(Starter.loc.Localize("txt_GMA_Exp_AU"), Starter.loc.Localize("txt_GMA_Exp_AU"))
        Loop

When i Check 2 RadioButtons (rbtn_Port_ja/nein and rbtn_Ref_ja/nein) and change the Oriantation, the App Crash with the Error above.

Any ideas where is the error?? Thank's
 

mw71

Active Member
Licensed User
Longtime User
Thanks for the Anser Erel.

In Release mode an Errror "List not Init....." is comming. This error I wanted to debug.
After I have still thought about this error (List not Init ...), I believe, i have the problem with this error recognized.

The CustomDialog I wrote about 1 year (or more) ago. It works fine, but I'll test the non-modal dialogs.
 
Upvote 0
Top