aspose file tools*
The moose likes Java Micro Edition and the fly likes SipConnectionNotifier + WTK problem Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Soft Skills this week in the Jobs Discussion forum!
JavaRanch » Java Forums » Mobile » Java Micro Edition
Bookmark "SipConnectionNotifier + WTK problem" Watch "SipConnectionNotifier + WTK problem" New topic
Author

SipConnectionNotifier + WTK problem

Mane ko
Greenhorn

Joined: Sep 14, 2010
Posts: 2
Hi,

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?
Tim Holloway
Saloon Keeper

Joined: Jun 25, 2001
Posts: 16305
    
  21

Welcome to the JavaRanch!

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.


Customer surveys are for companies who didn't pay proper attention to begin with.
Mane ko
Greenhorn

Joined: Sep 14, 2010
Posts: 2
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?
Tim Holloway
Saloon Keeper

Joined: Jun 25, 2001
Posts: 16305
    
  21

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.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: SipConnectionNotifier + WTK problem