Hi when I use the IP address as 10.0.2.2:5001, I am getting UnknownHost 
exception.
This is what I am doing:

Emulator 1: Listens on port 5000
Emulator2: Listens on port 5001. Both are service.
Now, when I click a button in emulator1, it posts data to II emulator using 
HTTP Post with IP address 10.0.2.2:5001.

But I m getting exception with stack trace:
10-23 07:49:13.725: W/System.err(346): java.net.UnknownHostException: 
http://10.0.2.2:5001
10-23 07:49:13.755: W/System.err(346): at 
java.net.InetAddress.lookupHostByName(InetAddress.java:506)
10-23 07:49:13.755: W/System.err(346): at 
java.net.InetAddress.getAllByNameImpl(InetAddress.java:294)
10-23 07:49:13.755: W/System.err(346): at 
java.net.InetAddress.getByName(InetAddress.java:325)
10-23 07:49:13.755: W/System.err(346): at 
com.example.devicecommunication.MainActivity.clickPost(MainActivity.java:73)
10-23 07:49:13.755: W/System.err(346): at 
java.lang.reflect.Method.invokeNative(Native Method)
10-23 07:49:13.755: W/System.err(346): at 
java.lang.reflect.Method.invoke(Method.java:507)
10-23 07:49:13.755: W/System.err(346): at 
android.view.View$1.onClick(View.java:2139)
10-23 07:49:13.755: W/System.err(346): at 
android.view.View.performClick(View.java:2485)
10-23 07:49:13.765: W/System.err(346): at 
android.view.View$PerformClick.run(View.java:9080)
10-23 07:49:13.765: W/System.err(346): at 
android.os.Handler.handleCallback(Handler.java:587)
10-23 07:49:13.765: W/System.err(346): at 
android.os.Handler.dispatchMessage(Handler.java:92)
10-23 07:49:13.765: W/System.err(346): at 
android.os.Looper.loop(Looper.java:123)
10-23 07:49:13.765: W/System.err(346): at 
android.app.ActivityThread.main(ActivityThread.java:3683)
10-23 07:49:13.765: W/System.err(346): at 
java.lang.reflect.Method.invokeNative(Native Method)
10-23 07:49:13.765: W/System.err(346): at 
java.lang.reflect.Method.invoke(Method.java:507)
10-23 07:49:13.765: W/System.err(346): at 
com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:839)
10-23 07:49:13.765: W/System.err(346): at 
com.android.internal.os.ZygoteInit.main(ZygoteInit.java:597)
10-23 07:49:13.765: W/System.err(346): at 
dalvik.system.NativeStart.main(Native Method)

Please help me in this regard.


On Tuesday, October 23, 2012 6:43:03 AM UTC+3, gjs wrote:
>
> Hi,
>
> Use Socket & ServerSocket classes
>
> Regards
>
> On Monday, October 22, 2012 5:29:16 PM UTC+11, Archana wrote:
>>
>> Hi, I want to send a text between 2 android emulator instances(by 
>> hard-coding the port numbers) using HTTP. I want a single apk file for 
>> this(so that it can run on 'n' instances later). Please let me know how to 
>> implement this? Thanks in advance!
>
>

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Reply via email to