3

i've created small http server in android , code is from this link just copy pasted in eclipse. http://www.java2s.com/Open-Source/Android/Samples/android-jp-kobe/net/cattaka/teamredwhite/HTTPServer.java.htm

How do i send simple request from browser to server now? I would like something like this 127.0.0.1:12345?x=100&y=50 for example. Browsers always says that he didnt make connection with that url. In on create of main activity i just created a server with port 12345 and run .listen()

user1281254
  • 31
  • 1
  • 4

1 Answers1

0

127.0.0.1 on is your local computer, not the emulator.

The emulator has its own network address space:

You're most likely looking for 10.0.2.15, "the emulated device's own network/ethernet interface", e.g. http://10.0.2.15:12345?x=100&y=50.

Philipp Reichart
  • 20,771
  • 6
  • 58
  • 65
  • browser says he didnt establish connection with that adress :( – user1281254 Apr 23 '12 at 13:19
  • Does the app run on the emulator or does it show exceptions in lgocat? Did you grant it the correct permissions, e.g. http://stackoverflow.com/questions/2169294/how-to-add-manifest-permission-to-android-application? – Philipp Reichart Apr 23 '12 at 13:21
  • I put internet permision. It is running on emulator it doesnt show exceptions in logcat :( – user1281254 Apr 23 '12 at 13:26