B4J Tutorial Network + AsyncStreams + B4XSerializator

This is the B4J version of this B4A example: Network + AsyncStreams + B4XSerializator
Note that B4XSerializator is cross platform, so it should be simple to use similar code to communicate with B4A or B4i programs.


The program implements a server and a client. The data sent is a custom type serialized (converted to bytes) with B4XSerializator.

The port is picked randomly. This is useful to allow testing it on the same computer. Run the program in release mode and run another instance from the command line.
Set the ip address to when connecting to the same PC.

Note that you need to open a port in Windows firewall for incoming connections if you want to allow other computers to connect.


  • NetworkExample.zip
    3.4 KB · Views: 1,088


Licensed User
Longtime User
Do you have more than one active network card (LAN + WiFi, LAN + LAN, etc)?

Richard Lord

Licensed User
Hi All,
I just tried the NetworkExample from above and this is the result of compile:-
B4J version: 5.50
Parsing code. (0.02s)
Compiling code. (0.13s)
Compiling layouts code. (0.02s)
Organizing libraries. (0.00s)
Compiling generated Java code. Error
B4J line: 34
javac 1.8.0_144
src\b4j\example\main.java:299: error: illegal '.'
this..catchState = 5;
1 error
Can anyone help please, do I need an update, do I have something missing, have I gone do-lally?