SipConnectionNotifier + WTK problem

I have just recently started working with sun wtk 2.52 for linux, my porblem is as following, for the time being I am developping a j2me sip client.
I am working on machine that have multiple network interfaces, eth0, eth1, eth2 and of course localhost.

The problem is when I want to crate SipClientNotifier object:

SipClientNotifier scn = (SipClientNotifier)Connector.open("sip:");

then when I want to check the network address on which scn is listening:

scn.getLocalAddress

it always return me the address of the localhost:

127.0.0.1:5090

and the application doesn't work , because alle sip message are sent to other interface of the machine, f.i eth1.

What should I do then to change the address on which scn is listening to?

It's not really possible to get the IP address from the network configuration. For one thing, a given interface might be set up to respond to more than one IP address, so there would be a question of which one was the "real" IP address.

Usually it's just easier to make the IP address an application option and use that value.

An IDE is no substitute for an Intelligent Developer.

Mane ko
Greenhorn

Joined: Sep 14, 2010
Posts: 2

posted Sep 14, 2010 06:34:59

0

Thank you for replying but still I don't understand it.

What i would like to do is to straughtly define network address and port on which the application should listen for incoming connections
, for example Connector.open("192.168.56.102:5061"), unfortunately I got error when I do like this.
In JavaSE when you open ScoketServer there is a method bind, where you could tell exactly the port and the address to which serversocket is atttached, I am looking for something similar in J2ME, or maybe there is any another way to make my application capturing all incoming packets on specified interface and port?

Actually "open" doesn't listen. There should be a separate listener and the ConnectionNotified is notified by the listener when a connection request comes in for the port(s) it's willing to respond to. I think that the getLocalAddress() method is actually supposed to be returning the IP address that the connection request came from, not the address that it was targeted to.

The open() method picks up on a request for communication and opens up a channel, but the actual port/NIC listening functions are done somewhere else. I don't know enough about this technology to know if the listener is a standard system component or if you have to set up one of your own.