B4J Tutorial Network + AsyncStreams + B4XSerializator

Discussion in 'B4J Tutorials' started by Erel, May 15, 2017.

  1. Erel

    Erel Administrator Staff Member Licensed User

    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.

    [​IMG]

    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.
     

    Attached Files:

    Peter Simpson, MarkusR and LucaMs like this.
  2. LucaMs

    LucaMs Expert Licensed User

    Simply double click on NetworkExample.jar ;)
     
    Erel likes this.
  3. Erel

    Erel Administrator Staff Member Licensed User

    That's a good option as well :)

    (if you encounter any issue then run it from the command line to see the logs)
     
    LucaMs likes this.
  4. magi6162

    magi6162 Well-Known Member Licensed User

    Sorry,
    I've tried your example. The IP value given by the application is always 192.168.56
    My network is 192.168.11.xxx
    What am I doing wrong
    thanks for help
     
  5. OliverA

    OliverA Well-Known Member Licensed User

    Do you have more than one active network card (LAN + WiFi, LAN + LAN, etc)?
     
  6. magi6162

    magi6162 Well-Known Member Licensed User

    yes, LAn(192.168.1.xx)+LAN(192.168.11.xxx+WIFI(192.168.11.xxx)
     
  7. magi6162

    magi6162 Well-Known Member Licensed User

    RESOLVE. I disabled networks card
     
  8. magi6162

    magi6162 Well-Known Member Licensed User

    sorry,
    If the server has 2 network cards (can not be disabled) how can I do it?

    thanks for help
     
  9. Erel

    Erel Administrator Staff Member Licensed User

    Please start a new thread for this question.
     
  10. Richard Lord

    Richard Lord New Member 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
    Try
    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?
    Thanks
     
  11. Erel

    Erel Administrator Staff Member Licensed User

  12. victormedranop

    victormedranop Active Member Licensed User

    That's the ip of virtual box nic .


     
Loading...
  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice