This week's book giveaway is in the Android forum.
We're giving away four copies of Head First Android and have David & Dawn Griffiths on-line!
See this thread for details.
Win a copy of Head First Android this week in the Android forum!

Anthony Wang

Greenhorn
+ Follow
since Nov 21, 2010
Cows and Likes
Cows
Total received
0
In last 30 days
0
Total given
0
Likes
Total received
0
Received in last 30 days
0
Total given
0
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by Anthony Wang

I use 10.0.2.15.
It works.
11 years ago
Setting up Redirections through the Emulator Console

Each emulator instance provides a control console the you can connect to, to issue commands that are specific to that instance. You can use the redir console command to set up redirections as needed for an emulator instance.

First, determine the console port number for the target emulator instance. For example, the console port number for the first emulator instance launched is 5554. Next, connect to the console of the target emulator instance, specifying its console port number, as follows:

telnet localhost 5554

Once connected, use the redir command to work with redirections. To add a redirection, use:.

redir add <protocol>:<host-port>:<guest-port>

where <protocol> is either tcp or udp, and <host-port> and <guest-port> sets the mapping between your own machine and the emulated system, respectively.

For example, the following command sets up a redirection that will handle all incoming TCP connections to your host (development) machine on 127.0.0.1:5000 and will pass them through to the emulated system's 10.0.2.15:6000.:

redir add tcp:5000:6000

Or UDP
redir add udp:5000:6000

To delete a redirection, you can use the redir del command. To list all redirections for a specific instance, you can use redir list. For more information about these and other console commands, see Using the Emulator Console.

Note that port numbers are restricted by your local environment. this typically means that you cannot use host port numbers under 1024 without special administrator privileges. Also, you won't be able to set up a redirection for a host port that is already in use by another process on your machine. In that case, redir generates an error message to that effect.
11 years ago
When I tried to run this progarm I got exception error in creating sockets (both server and client): (in Windows XP professional)
11-21 14:31:45.773: DEBUG/UDP(217): S: Connecting...
11-21 14:31:46.613: DEBUG/UDP(217): C: Connecting...
11-21 14:31:47.323: ERROR/UDP(217): S: Error
11-21 14:31:47.323: ERROR/UDP(217): java.net.SocketException: Permission denied (maybe missing INTERNET permission)
11-21 14:31:47.323: ERROR/UDP(217): at org.apache.harmony.luni.platform.OSNetworkSystem.createDatagramSocketImpl(Native Method)
11-21 14:31:47.323: ERROR/UDP(217): at org.apache.harmony.luni.platform.OSNetworkSystem.createDatagramSocket(OSNetworkSystem.java:90)
11-21 14:31:47.323: ERROR/UDP(217): at org.apache.harmony.luni.net.PlainDatagramSocketImpl.create(PlainDatagramSocketImpl.java:148)
11-21 14:31:47.323: ERROR/UDP(217): at java.net.DatagramSocket.createSocket(DatagramSocket.java:209)
11-21 14:31:47.323: ERROR/UDP(217): at java.net.DatagramSocket.<init>(DatagramSocket.java:107)
11-21 14:31:47.323: ERROR/UDP(217): at com.net.udpconnection.Server.run(Server.java:24)
11-21 14:31:47.323: ERROR/UDP(217): at java.lang.Thread.run(Thread.java:1060)
11-21 14:31:47.563: ERROR/UDP(217): C: Error
11-21 14:31:47.563: ERROR/UDP(217): java.net.SocketException: Permission denied (maybe missing INTERNET permission)
11-21 14:31:47.563: ERROR/UDP(217): at org.apache.harmony.luni.platform.OSNetworkSystem.createDatagramSocketImpl(Native Method)
11-21 14:31:47.563: ERROR/UDP(217): at org.apache.harmony.luni.platform.OSNetworkSystem.createDatagramSocket(OSNetworkSystem.java:90)
11-21 14:31:47.563: ERROR/UDP(217): at org.apache.harmony.luni.net.PlainDatagramSocketImpl.create(PlainDatagramSocketImpl.java:148)
11-21 14:31:47.563: ERROR/UDP(217): at java.net.DatagramSocket.createSocket(DatagramSocket.java:209)
11-21 14:31:47.563: ERROR/UDP(217): at java.net.DatagramSocket.<init>(DatagramSocket.java:88)
11-21 14:31:47.563: ERROR/UDP(217): at java.net.DatagramSocket.<init>(DatagramSocket.java:71)
11-21 14:31:47.563: ERROR/UDP(217): at com.net.udpconnection.Client.run(Client.java:21)
11-21 14:31:47.563: ERROR/UDP(217): at java.lang.Thread.run(Thread.java:1060)

How to correct it?
11 years ago