1. Download our Official Android App: Forums for Android!

Apps How to create Socket connection via Wifi of Mobile Network?

Discussion in 'Android Development' started by levanphong7887, May 25, 2011.

  1. levanphong7887

    Thread Starter
    Rank:
    None
    Points:
    5
    Posts:
    4
    Joined:
    May 25, 2011

    May 25, 2011
    4
    1
    5
    Hi all,
    I want to create a client socket connection with a special network
    type.
    Example:
    Socket socket = new Socket("10.0.0.21", 10000, "use wifi network");
    or
    Socket socket = new Socket("10.0.0.21", 10000, "use mobile network");

    How to do it?
    Many thanks !
     

    Advertisement

  2. miXer

    miXer Android Enthusiast
    Rank:
    None
    Points:
    53
    Posts:
    313
    Joined:
    Aug 12, 2010

    Aug 12, 2010
    313
    51
    53
    Norway
    Android uses wifi or mobile automatically. If mobile and wifi is turned on android uses wifi. So to use a specific connection, you need to turn off on or the other manually or with code.
     
    levanphong7887 likes this.

Share This Page

Loading...