This week's book giveaway is in the Servlets forum.
We're giving away four copies of Murach's Java Servlets and JSP and have Joel Murach on-line!
See this thread for details.
The moose likes Android and the fly likes TCP socket communication with wired internet (not WLAN) Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Mobile » Android
Bookmark "TCP socket communication with wired internet (not WLAN)" Watch "TCP socket communication with wired internet (not WLAN)" New topic
Author

TCP socket communication with wired internet (not WLAN)

Madhu Nandan
Ranch Hand

Joined: Dec 16, 2010
Posts: 52

Hello,

I have a rather basic question regarding TCP socket communication.

I have an android app (client) which communicates with server on PC (or laptop) via TCP sockets.

When I run this set-up with WLAN, it works fine. But when I try to run the same thing with wired internet, the android app doesn't work. It will not even install on the phone. I get this diagnostic info in Eclipse LogCat: java.net.SocketException: Address family not supported.

So does TCP socket communication work only on wireless network?

Thanks for the time.

Cheers,
Madhu
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 41060
    
  43
What do you mean by "wired internet"? How is the phone connected to the desktop machine, and how did you enable internet connectivity?


Ping & DNS - my free Android networking tools app
Madhu Nandan
Ranch Hand

Joined: Dec 16, 2010
Posts: 52

Ulf Dittmer wrote:What do you mean by "wired internet"? How is the phone connected to the desktop machine, and how did you enable internet connectivity?


By wired internet I mean plug in a internet cable, not wifi.

And I have installed the android app on the phone by connecting phone USB cable. If the internet is wifi, I can run the the server-client setup properly. If the internet is not wifi, then I cannot even install the app on the phone (and obviously cannot run the server-client setup); I get the message as shown in the previous post in LogCat of Eclipse.

Hope I have given a better picture of the situation.

Madhu
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 41060
    
  43
By wired internet I mean plug in a internet cable, not wifi.

That provides connectivity to the desktop machine, not to the device. How are you providing internet connectivity to the device? Or am I to understand that the "internet cable" actually plugs into the device? That sounds unlikely.

If the internet is not wifi, then I cannot even install the app on the phone (and obviously cannot run the server-client setup)

Installing apps happens over USB cable; it is completely independent of any internet connectivity.

If by "If the internet is not wifi" you mean that the device is not connected via WLAN, then it should still have connectivity over the air (assuming that it is a phone, and that your phone plan includes data, but if you have an Android phone it probably does). Obviously, it would not be able to connect to anything on your local WLAN.
Madhu Nandan
Ranch Hand

Joined: Dec 16, 2010
Posts: 52

Ulf Dittmer wrote:
By wired internet I mean plug in a internet cable, not wifi.

That provides connectivity to the desktop machine, not to the device. How are you providing internet connectivity to the device? Or am I to understand that the "internet cable" actually plugs into the device? That sounds unlikely.

If the internet is not wifi, then I cannot even install the app on the phone (and obviously cannot run the server-client setup)

Installing apps happens over USB cable; it is completely independent of any internet connectivity.

If by "If the internet is not wifi" you mean that the device is not connected via WLAN, then it should still have connectivity over the air (assuming that it is a phone, and that your phone plan includes data, but if you have an Android phone it probably does). Obviously, it would not be able to connect to anything on your local WLAN.


I think I was quite stupid and did not understand the situation properly myself.

When I used wifi, I had internet for both PC (or laptop) and phone. When I tried with wired internet (without wifi), I had internet only for PC and not for phone (no data plan as well). So obviously the client in the phone cannot connect to the server in the PC in this case.

Thank you for your time and efforts (rather apologise for this not so intelligent question ;-)

Madhu
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: TCP socket communication with wired internet (not WLAN)
 
Similar Threads
Problem running app with Eclipse
How to pass string from TCP server (a Runnable) to main activity (in Android)?
TCP socket ip address
Phone to phone/emulator comminication
SSL Communication between Java and VC++