If you leave out the host name part of the URI in the Connector.open() will return a ServerSocketConnection. You can then use acceptAndOpen to receive connections. The problem is for other systems finding your IP address and connecting. It should work on Wi-Fi, and I have sent UDP packets between BlackBerries on the same carrier, but (at least with my carrier) the phones end up NATed behind the carier's firewall.

Hi,
I have to create a server socket for accepting connections. For that how do i get the ip address of the phone (simulator) . I have used the following code to retrieve the ip.
{
scn = (ServerSocketConnection)Connector.open("socket://:1234");
System.out.println("IP Address----" + scn.getLocalAddress().toString()+"\n");
}

Not all methods of connection are actually implemented by TCP/IP stacks on the phone so there is no IP address associated with the phone in that case. You will need to select a connectiion method that supports an IP address. Not all the connections that support IP addresses are available for the simulator, in fact I'm not sure any are.