Just fixed a strange error that might be worth mentioning.
Some weeks ago I added some code to be able to send data (in my case just a SQL string) to other users on the WiFi network.
Taken from this example project posted by Erel:
www.b4x.com
All working fine, with no trouble at all.
Then yesterday I had a new phone (Samsung S25) and installed the app on that phone as well.
From then on I got on all the phones (only on every other app start) this error:
java.lang.RuntimeException: java.net.BindException: bind failed: EADDRINUSE (Address already in use)
at anywheresoftware.b4a.keywords.Common$14.run(Common.java:1750)
at android.os.Handler.handleCallback(Handler.java:959)
at android.os.Handler.dispatchMessage(Handler.java:100)
at android.os.Looper.loopOnce(Looper.java:257)
at android.os.Looper.loop(Looper.java:342)
at android.app.ActivityThread.main(ActivityThread.java:9579)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:619)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:929)
Caused by: java.net.BindException: bind failed: EADDRINUSE (Address already in use)
at libcore.io.IoBridge.bind(IoBridge.java:149)
at java.net.PlainSocketImpl.socketBind(PlainSocketImpl.java:162)
at java.net.AbstractPlainSocketImpl.bind(AbstractPlainSocketImpl.java:427)
at java.net.ServerSocket.bind(ServerSocket.java:399)
at java.net.ServerSocket.<init>(ServerSocket.java:259)
at java.net.ServerSocket.<init>(ServerSocket.java:151)
at anywheresoftware.b4a.objects.SocketWrapper$ServerSocketWrapper.Initialize(SocketWrapper.java:314)
at b4a.exampleljjll.p_sqledit._initialize(p_sqledit.java:6684)
at b4a.exampleljjll.b4xmainpage$ResumableSub_CreatePage.resume(b4xmainpage.java:9887)
at b4a.exampleljjll.b4xmainpage._createpage(b4xmainpage.java:9377)
at b4a.exampleljjll.b4xmainpage$ResumableSub_InitApp.resume(b4xmainpage.java:32908)
at anywheresoftware.b4a.keywords.Common$14.run(Common.java:1748)
... 8 more
Caused by: android.system.ErrnoException: bind failed: EADDRINUSE (Address already in use)
at libcore.io.Linux.bind(Native Method)
at libcore.io.ForwardingOs.bind(ForwardingOs.java:138)
at libcore.io.ForwardingOs.bind(ForwardingOs.java:138)
at libcore.io.IoBridge.bind(IoBridge.java:145)
... 19 more
Error did never occur in debug mode and some trouble finding the cause but eventually tracked it down to this bit of code in my SQL page:
This always ran on app startup.
Taking this out and only running
When I want to communicate with other devices solved the startup error and crash.
Next to see what happens when I run that after startup.
The strange thing about all this is that it only occurred after using that new S25.
RBS
Some weeks ago I added some code to be able to send data (in my case just a SQL string) to other users on the WiFi network.
Taken from this example project posted by Erel:
[B4X] Network + AsyncStreams + B4XSerializator
Better implementation, based on B4XPages: https://www.b4x.com/android/forum/threads/b4x-b4xpages-network-asyncstreams-b4xserializator.119011/#content New video tutorial: This is a simple and important example. It demonstrates several good practices related to network...

All working fine, with no trouble at all.
Then yesterday I had a new phone (Samsung S25) and installed the app on that phone as well.
From then on I got on all the phones (only on every other app start) this error:
java.lang.RuntimeException: java.net.BindException: bind failed: EADDRINUSE (Address already in use)
at anywheresoftware.b4a.keywords.Common$14.run(Common.java:1750)
at android.os.Handler.handleCallback(Handler.java:959)
at android.os.Handler.dispatchMessage(Handler.java:100)
at android.os.Looper.loopOnce(Looper.java:257)
at android.os.Looper.loop(Looper.java:342)
at android.app.ActivityThread.main(ActivityThread.java:9579)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:619)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:929)
Caused by: java.net.BindException: bind failed: EADDRINUSE (Address already in use)
at libcore.io.IoBridge.bind(IoBridge.java:149)
at java.net.PlainSocketImpl.socketBind(PlainSocketImpl.java:162)
at java.net.AbstractPlainSocketImpl.bind(AbstractPlainSocketImpl.java:427)
at java.net.ServerSocket.bind(ServerSocket.java:399)
at java.net.ServerSocket.<init>(ServerSocket.java:259)
at java.net.ServerSocket.<init>(ServerSocket.java:151)
at anywheresoftware.b4a.objects.SocketWrapper$ServerSocketWrapper.Initialize(SocketWrapper.java:314)
at b4a.exampleljjll.p_sqledit._initialize(p_sqledit.java:6684)
at b4a.exampleljjll.b4xmainpage$ResumableSub_CreatePage.resume(b4xmainpage.java:9887)
at b4a.exampleljjll.b4xmainpage._createpage(b4xmainpage.java:9377)
at b4a.exampleljjll.b4xmainpage$ResumableSub_InitApp.resume(b4xmainpage.java:32908)
at anywheresoftware.b4a.keywords.Common$14.run(Common.java:1748)
... 8 more
Caused by: android.system.ErrnoException: bind failed: EADDRINUSE (Address already in use)
at libcore.io.Linux.bind(Native Method)
at libcore.io.ForwardingOs.bind(ForwardingOs.java:138)
at libcore.io.ForwardingOs.bind(ForwardingOs.java:138)
at libcore.io.IoBridge.bind(IoBridge.java:145)
... 19 more
Error did never occur in debug mode and some trouble finding the cause but eventually tracked it down to this bit of code in my SQL page:
B4X:
Public Sub Initialize(iPageCode As Int) As Object
server.Initialize(PORT, "server")
ListenForConnections
This always ran on app startup.
Taking this out and only running
B4X:
server.Initialize(PORT, "server")
ListenForConnections
When I want to communicate with other devices solved the startup error and crash.
Next to see what happens when I run that after startup.
The strange thing about all this is that it only occurred after using that new S25.
RBS