powered by Jive Software

Problem to use ICETransportManager


first i wan’t to introduce myself:

My name is Christoph and i’m a student of computer science at the university of berlin, germany. I’m writing an eclipse plugin for distributed pair programming and use the Smack-API to exchange messages between the users.

I have a problem to use the ICETransportManager to obtain usable ip-adresses for a P2P session. If the machine is behind a NAT-Firewall i get a BindException when creating an instance.

My Code:

ICETransportManager ice = new ICETransportManager(xmppConnection, “stun.xten.net”, 3478);

java.net.BindException: Cannot assign requested address: Cannot bind
at java.net.PlainDatagramSocketImpl.bind0(Native Method)
at java.net.PlainDatagramSocketImpl.bind(Unknown Source)
at java.net.DatagramSocket.bind(Unknown Source)
at java.net.DatagramSocket.(Unknown Source)
at java.net.DatagramSocket.(Unknown Source)
at de.javawi.jstun.test.demo.ice.Candidate.(Candidate.java:44)
at de.javawi.jstun.test.demo.ice.ICENegociator.gatherCandidateAddresses(ICENegocia tor.java:87)
at org.jivesoftware.smackx.jingle.nat.ICEResolver.initialize(ICEResolver.java:81)
at org.jivesoftware.smackx.jingle.nat.TransportResolver.initializeAndWait(Transpor tResolver.java:387)
at org.jivesoftware.smackx.jingle.nat.ICETransportManager.(ICETransportManag er.java:36)

Any ideas?

Sorry for the missing version number.

Smack-Version: 3.1


I was wondering whether you are using the ICETransportMananger in conjunction with the Smack-Jingle Extensions?



Hi Earlence,

thanks for your reply !

Yes, i use the ICETransportManager with jingle:

ICETransportManager icetm0 = new ICETransportManager(xmppConnection,
stunserver.org”, 3478);

mediaManager = new FileMediaManager(icetm0);

List medias = new Vector();

jm = new JingleManager(xmppConnection, medias);

jm.addJingleSessionRequestListener(new JingleSessionRequestListener() {
public void sessionRequested(JingleSessionRequest request) {

JID jid = new JID(request.getFrom());
JingleSession incoming = incomingSessions.get(jid);

if (incoming != null)

try {
// Accept the call
incoming = request.accept();

initJingleListener(incoming, new JID(incoming
/* put to current session list. */
incomingSessions.put(jid, incoming);
// Start the call
} catch (XMPPException e) {

When i use “stunserver.org” instead of “stun.xten.net” i don’t get the exception. I don’t know why.


thanks for your reply, I am new to using jingle, could you send some pointers on how to use it?

I am trying to get jingle to work on android,



Hi !

There is a jingle demo in smack:


You can also look at our code at sourceforge:


The two main classes for jingle are:

http://dpp.svn.sourceforge.net/viewvc/dpp/trunk/dpp/de.fu_berlin.inf.dpp/src/de/ fu_berlin/inf/dpp/net/jingle/JingleFileTransferManager.java?view=markup

http://dpp.svn.sourceforge.net/viewvc/dpp/trunk/dpp/de.fu_berlin.inf.dpp/src/de/ fu_berlin/inf/dpp/net/jingle/JingleFileTransferSession.java?view=markup

If you find bugs in our code, please send us a bug report and/or a patch at sourceforge:




got this error (java.net.BindException: Cannot assign requested address: Cannot bind) in jingle demo on jabber.org and gmail account with different stun servers. Firewall disabled. OS: winXPsp3.


I am developing a screen share application with smack_3_1_0.

I am also facing this problem.

This is because once the STUN server resolves Public IP we are binding that public IP in local machine,

that why we are getting the Bind Exception…

This is happening in jstun-0.7.3 code in the file src/de/javawi/jstun/test/demo/ice/Candidate.java

I posted this question to development team but till now did not get any reply

Why we are binding public IP in local machine?

is this a problem with the code or could someone explain what is the logic behind this?



Hi Hinandu,

I’m also trying to work with the Jingle implementation in Smack and I’m having the same problem. Can we exchage emails to talk a little more of what may be happening here and keep in touch if we manage to solve the problem and post a solution here.

My email is: iaroman@gmail.com


are you able to solve the problem?

let me know how you are testing you application.

If at all you find any solution, post on the group.



Hi Nandu,

I finally managed to create a Jingle connection but first I want to see the code you are trying to use and compare it to mine before posting the solution here. I’ve made so many changes in my setup (firewall, server) and code I want to know for sure what was the problem.

Also I would like for you to test my code on your setup and see if it works before posting the solution here.


Hi ismakun,

My test setup is as follows.

I am running the demo app on two private networks which are connect to two public address.

These public addresses are one is behind Restricted Cone NAT and another one is behind Port Restricted Cone NAT.

I was able to get the public addresses from STUN, after getting the public IP in jstun code, they are binding this public

in src/de/javawi/jstun/test/demo/ice/Candidate.java which is giving this binding Exception.

could you provide be you code so that i ll test your code on my machine or if you can list out what are the changes you did in jstun or smack code that would be great help to all.

by the way i am using the stun server as jstun.javawi.de.



Sorry for not having a reply I still dont have a final solution. I have stumbled with so many problems using smack jingle implementation and openfire.

I think there is defenetly an error in JSTUN lib because if any ipaddress is behind a nat is trying to bind the public ip. I did a ugly fix but still is not enough but now I have read a lot more about the subject and I think I can create a better fix.

Also I didnt understand why it was not using the server as a media relay although the option was on in the server and found the RTPBridge method that checks this was cheking the wrong type in the implementation. I changed that in the source and now the server is creating the RTPBridge. The problem now is for some reason both endpoints are creating rtpbridges instead of one creating it and loking at port A and the other using port B.

I think this week I will have this running and will post the compiled smack-jingle.jar with the changes I’ve made.

Also I changed the JSTUN 0.7.2 to 0.7.3.

Does RTPBridge connection worked for you using the media relay of the server?