Create a socket with public IP and internal IP in java

41 views Asked by At

We are trying to implement xmpp jingle protocol in our application , the jingle sturcture is as following :

<iq
xmlns="jabber:client" lang="en" to="usera@domain/resource" from="userb@domain/resouce" type="set" id="087ec7ed11">
<jingle
    xmlns="urn:xmpp:jingle:1" action="transport-info" initiator="usera@doamin/resource-Android-813489" sid="087ec7ed10">
    <content>
        <transport
            xmlns="urn:xmpp:jingle:transports:ice-udp:1" pwd="nFhd+tKRWf+HBFYoDYJekI" ufrag="U3s5">
            <candidate component="1" foundation="1" generation="0" ip="192.168.1.39" network="0" port="46948" priority="2130706432" protocol="udp" type="host" id="0"/>
            <candidate component="1" foundation="2" generation="0" ip="5.0.73.229" network="1" port="2958" priority="1694498815" protocol="udp" type="srflx" id="1" rel-addr="192.168.1.39" rel-port="46948"/>
        </transport>
    </content>
</jingle>
</iq>

as you can see we have two IPs and two ports one as public and the other is internal (behind NAT if i'm not wrong)

public : ip="5.0.73.229"  port="2958" 
internal : rel-addr="192.168.1.39" rel-port="46948"

so in java what kind of sockets we should use to achieve a p2p between two clients.

0

There are 0 answers