Menu

Choosing between Dual-Homed Interfaces...

2013-07-16
2013-07-16
  • David Schofield

    David Schofield - 2013-07-16

    My apologies...I'd posted this under "Wired Ethernet Support" which probably sounded dumb. The thing is I've got a dual-homed system (wired ethernet as Eth0; and WiFi as wlan0) with Modbus/TCP on Eth0.

    However, the OS (Android) prefers and defaults to WiFi, and even though I can ping my WAGO fieldbus data acq system under Android (and can talk to it from a PC) but j2mod throws an exception when trying to connect the TCPMasterConnection.

    Q. Has anyone been successful using j2mod under Android?
    Q. Does anyone know the syntax and location for using either the named-interface form of socket bind() or the InetAddress getNamedInterface() to make this work? Would it work?

    I'm on a two computer network, point-to-point network, Android system is static IP'd at 10.10.220.3 (gateway and DNS1/2 on 10.10.220.10) and the WAGO static IP'd at 10.10.220.10.

    It fails both with a crossover cable and with an auto-polarity switch in the middle.

    I'd even be willing to provide a small reward, out of my own pocket.
    Thanks!
    David Schofield
    Cell 412 726 1147

     

    Last edit: David Schofield 2013-07-16
  • Josh Hansen

    Josh Hansen - 2013-07-16

    Hi David,

    A couple things to try:

    * Try binding to address 0.0.0.0.  This binds to all addresses and (I think) all interfaces.
    * Since Android is Linux based, it may have a restriction where root is required to bind to ports <= 1024.  Try using port 50002 (and update your client accordingly).
    * Android may have other permission restrictions; I don't know how they are managed or set internally, but whenever I install an Android app, "Network access" is one of the permissions that an app can request, so you may need to figure out how to allow that.
    

    Also, can you paste the full exception and stack trace, along with the version of j2mod that you are using?

    You can get a little more output (to the console) by specifying "-Dcom.ghgande.modbus.debug=true" as Java argument, e.g.

    $ java -Dcom.ghgande.modbus.debug=true MyMainClass
    

    I'm not sure what the corresponding Android invocation is.

    Josh

    EDIT: Formatting.

     

    Last edit: Josh Hansen 2013-07-16
  • Josh Hansen

    Josh Hansen - 2013-07-16

    Hi David,

    Another question: Are you able to access it via the Wi-Fi interface?

     
  • Josh Hansen

    Josh Hansen - 2013-07-16

    Hi David,

    Yet another question: Which device is the server (slave), and which is the client (master)?

    Josh

     

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.