beta
Hello developer. Login with your existing account. New to Vodafone Developer? Register your account.

+ Login or create an account

0

Hi there

I'm trying to run a server on my midlet which waits for a connection. The serving midlet will post an ip up onto the web and another midlet reads that ip, and connects to it.

The code used to start the server is this.
scn = (ServerSocketConnection) Connector.open("socket://:" + C.PORT);
sc = (SocketConnection) scn.acceptAndOpen();
I'm currently using port #5000.

It works fine on my emulator, but the IP which is being used is "192.168.0.2", which is my local IP on the desktop machine.

When i actually try to get the ip via scn.getLocalAddress(), the IP i get is 10.x.x.x, which i beleive is not a valid ip to use over the internet.

Is there a way to retrieve the IP so that other devices can find my midlet (either via WAP or GPRS)?

And do i need to contact Vodafone so they unblock any custom ports i use?

2 Answers:

0
hey pete hmm, i can deal with it being in the same network. i have 2 phones i can test with and theyre both on Vodafone prepaid (Australian). (Nokia 6300 and Nokia 6151) Hmm, im ok with it not being able to connect to a machine on the internet. I just want two phones to connect to each other using TCP/IP.
0
hi Twig, The exact behaviour you are experiencing will depend on the particular mobile network you are using but I'm fairly sure the address you are seeing (the 10.xxx) is a DHCP assigned address from the mobile network you are connected to. Depending on the firewalls and packet filters in the mobile network you are using, this may not be a problem for you since I'm assuming the MIDlets you are trying to get to talk to each other will be connecting to the same network. What you won't be able to do is to get an 'Internet visible' IP address i.e. you can't run your Socket server and have a machine on the general Internet connect to it (not without developing some server-based proxy functionality). Can you confirm the mobile network and country you are using? If you are happy to create a project on the site and upload your application, we can test this and offer some suggestions... thanks, Pete

Login and answer the question