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 127.0.0.1 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.
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 127.0.0.1 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.