Forward Ports with uPNP...

Hey...

May anyone suggest me an easy way to get my mind on uPNP?... Is there an easy to use library out there?...

I tried my luck on the MSDN COM-depending way and it did overhelm me, since I don´t want this to become my major problem.

Thanks in advance:)
Intel do quite a good book and open source reference implementation. I have a copy and can recomend it.
http://www.intel.com/intelpress/sum_upnp.htm

It uses multicast, well SSDP does. Do you really need port forwarding for discovery?
Last edited on
I think that I need it, because my client will not receieve any messages from my host - on the same computer - without using the localhost address...

Or are there other solutions?... I´m in game for any suggestion:)... (but I don´t want to bind the client port)...


EDIT: Where to buy the super-toaster?:D...

EDIT 2: Correct me if I am wrong, but the excerpts explain how to implement uPNP descriptions for my own device - which I don´t have^^ - and not how to use uPNP (in my particular case: Port Forwarding on the FritzBox)...

EDIT 3: I´m thinking about hole-Punching... dunno if my router detects this or not... let´s see... (any suggestions for other solutions are still appreciated :) )...
Last edited on
Multicast is subscribe/publish, not point-to-point like udp/tcp so it shouldn't use 127.0.0.x.

Can I assume that all other comms between the client and server are working?

Yes, the references are from an implementation point of view. It all depends on how much you care to know as to whether it's useful or not.
Multicast is subscribe/publish, not point-to-point like udp/tcp so it shouldn't use 127.0.0.x.
<- I do not understand to what You refer to with this

Can I assume that all other comms between the client and server are working?

I have my server that binds two ports to communicate over it - receiving and sending succeeds without any problems.
The client, of course, does not bind its communications port. Sending is no problem on the client, too. But it can´t receive anything if the Server sends the data to the sockaddress structure, that got filled by recvfrom(sock, buf, len, flag, sockaddr, fromlen); It does only work if the client sends data over an "non-internet-related" address specified in getaddrinfo("localhost", ...) and not getaddrinfo("myaddr",...)


Yes, the references are from an implementation point of view. It all depends on how much you care to know as to whether it's useful or not.


It is interesting to read about the structure of the XML-files (this is one fo the things i was wondering about, while reading in the msdn)...



EDIT: forgot to mention, that I did open the bound ports for the server process on my router manually...
Last edited on
Hole Punching does not work:(...

Do You have any other suggestions?... Or maybe could You explain to me what do in that Multicast-thing... I fully understand it.
ok... I think i got the SSDP and the SOAP Messages set up, baed on the UPnP-Forum Standards/Documents

but I still have problems understanding a few Argument that are mandatory in the messages...

SSDP: (works)
1
2
3
4
5
M-SEARCH * HTTP/1.1\r\n
HOST: 239.255.255.250:1900
MAN: "ssdp:discover"
MX: 3
ST: urn:schemas-upnp-org:device:InternetGatewayDevice:1


SOAP:(some problems here)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
POST /*path?*/ HTTP/1.0
HOST: /*myip:myPort??*/
CONTENT-LENGTH length of the body
CONTENT-TYPE: text/xml; charset="utf-8"
SOAPACTION: "urn:schemas-upnp-org:service:WANIPConnection:1#AddPortMapping"

<s:Envelope
xmlns:s="http://schemas.xmlsoap.org/soap/envelope/"
s:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/">
<s:Body>
    <u:AddPortMapping xmlns:u="urn:schemas-upnp-org:service:WANIPConnection:1">
        <NewRemoteHost>/*IP of the target*/</NewRemoteHost>
        <NewExternalPort>/*PortNumber*/</NewExternalPort>
        <NewProtocol>/*Protocol*/</NewProtocol>
        <NewInternalPort>/*port*/</NewInternalPort>
        <NewInternalClient>/*My IP (internal lan ip)*/</NewInternalClient>
        <NewEnabled>1</NewEnabled>
        <NewPortMappingDescription>""</NewPortMappingDescription>
        <NewLeaseDuration>/*INFITNITE?*/</NewLeaseDuration>
</u:AddPortMapping>
</s:Body>
</s:Envelope>


1. What path follows the POST?
2.HOST: My IP or the devices?
3.to i need to do the tabbings in the final message for the xml-style?...
5. is it really <u:AddPortMapping or do i have to write: <u:actionName="AddPortMapping" ?


greetz,
Inc
Last edited on
Topic archived. No new replies allowed.