|
Exactly, but how do i know from which port a data package from the other side will come? For example:
Step 1: Client 1 sends a UDP Package to the Server (IP: 1.1.1.1:1000)
Step 2: Client 2 sends a UDP Package to the Server (IP: 2.2.2.2:2000)
Step 3: Client 1 and Client 2 gets the UDP Informations from each other from the server
Step 4: Client 1 (LAN: 192.168.1.1:61000, WAN:1.1.1.1:1001)sends a UDP Package to Client 2 (2.2.2.2:2000) (!! Couldn't work! Port 2000 is reserved for the server-address and port)
Step 5: Client 2 (LAN: 192.168.1.2:62000, WAN:2.2.2.2:2001) sends a UDP Package to Client 1 (1.1.1.1:1000) (!! Same problem like in Step 4)
So... here you see the problem. I must find out from which port the Client 1 WILL send his data the same for Client 2. And there i found no solution.
|
|
|
|
|
Well that's really an unrelated problem - and there is no good solution. This is why most virtual networks (in the broadest sense) have at least 1 central server, even the P2P DHT networks do because otherwise you don't have a "starting point" from which to explore the other nodes. Now you could just keep it simple and have a rule that "I will talk on port 2000" and that would work, but without such a rule you need a known place to store which port goes with which address. I know it's ugly, it's just the way it is..
|
|
|
|
|
well a starting point is avaliable, that's the server, which holds the communication informations (id of the node, port from the listener, public ip, local ip and so on)...
|
|
|
|
|
Ok so, what is the problem then? You want to talk to a node on a different port then it says it opened?
|
|
|
|
|
Look at my previous post with the different steps. The NAT Browser doesn't use the same port for the connection to client 2 like to the connection of the server. And how can i "hit the right port?" i doesn't understand that
|
|
|
|
|
Just open both ports then
|
|
|
|
|
can you specify that? or write a few lines of code, that i can follow you?
|
|
|
|
|
PunchHole(ip, 2000);
PunchHole(ip, 2001);
|
|
|
|
|
Well... if i had now the Method/Function "PunchHole" i could imagine what you mean. That's not a C# Problem from my side, it's a logical problem, what to do to get this connection. I can't open the port and make a connection, because the other side doesn't know on which port i send this package and the other side doesn't know on which port the other side will answer and to find that out is my problem
|
|
|
|
|
Sure you know, 2000 and 2001, because that's what you specified, it's not random
|
|
|
|
|
How do i specifiy that? Well... you mean, that's on which port i listen right? But that would only works in a LAN, not in a WAN, my Router doesn't open a port if my PC listens on 2000/2001 for example. So i can't access Client1 from Client2 if i send a package to "Client1:2000" from Internet, because the router doesn't know what to do with Port 2000. That's right or not?
|
|
|
|
|
Yes that's why you punch a hole before listening, but it's still the same port
|
|
|
|
|
Well really i don't understand how that should works. OK, say following, i have the IP address of client 1 and client 2... then i make following:
Client 1 -> sends UDP package to Client 2 (which port?)
This UDP Package will get blocked by CLient 2s NAT
Client 2 -> sends UDP package to Client 1 (how do Client 2 knows which port)
Could you make a short example a short "Step-for-Step-List" (like i made above with example Ports/IPs and so on) or maybe a short code for that problem? I really get no idea i get more confused and more confused :P
Well on the webpages and so on it sounds sooo easy and it is easy, if i know the ports but i think i need a concrete Step for step list or a short code from you to understand that. I've tested a whole week, with a lot of possibilities how that could get to work but nothing works (except the client-server connection )
|
|
|
|
|
Client1:2000 sends to Client2:2000 now Client2:2000 can send back to Client1:2000 (packet should never reach destination, but that's ok)
Client2:2000 sends to Client1:2000 so now Client1:2000 can send back to Client2:2000
And then the connection is open both ways.
If it doesn't work the router is being annoying and assigning a random other port to the connection.
|
|
|
|
|
This would only work in a LAN!? Exactly that is the problem, that the Router takes another Port to open the connection, but i can't send a answer to the Client 1 if i didn't know which Port the Router from Client 1 use. Or did i misunderstood something?
|
|
|
|
|
AFAIK it's supposed to work, maybe not with symmetric NAT
|
|
|
|
|
|
That looks exactly like what I said actually
Still, it probably won't work with symmetric NAT (I hope it's rare)
|
|
|
|
|
so now i had a little bit time to test that, i've found this code:
[^]
I've ported it to c# and it works fine in a LAN!! But if i test it over WAN, the Client2 want to send the UDP Package to "localaddress:16000" and that couldn't work because my router doesn't use port 16000! it uses a random port! And so how to do that now?
|
|
|
|
|
Ok, well, it worked over LAN but it isn't needed over LAN - so this could mean that it did silently failed (at least in theory, it could)
But now, I don't know man, that is bad.. port forwarding would work, but it's not very reliable.. I think there has to be an other way, but I don't know it..
|
|
|
|
|
Hey I am facing exactly same problem .
please guide me as well on this.
|
|
|
|
|
hi everybody,
I use toolstrip button in windows application using c#.
i have toolstrip in mdi child form.
when i click the toolstrip button it open the related form.
The prob is here that i clicked that button again it open another form.
the related form opened again & again when i clicked.
i need only the form is opened once when i click it multiple times.
please help me.
|
|
|
|
|
Disable the button when the related form is opened, and re-enable it when the related form closes.
Henry Minute
Do not read medical books! You could die of a misprint. - Mark Twain
Girl: (staring) "Why do you need an icy cucumber?"
“I want to report a fraud. The government is lying to us all.”
|
|
|
|
|
Well, after months of trying to figure out the whole Regex stuff, I'm glad to say that I just stumbled upon this cute little website. It's a Regex cheat sheet, and as soon as I read the first page, I understood everything. This site was so helpful and so I thought I might aswell share it with everybody!
Jay.
Oops, I almost forgot to paste the link. Here it is:
http://krijnhoetmer.nl/stuff/regex/cheat-sheet/[^]
foreach( inch on Jason )
{
Girlfriend.IsHappier();
}
|
|
|
|
|
Just printed it, thanks for sharing
I are troll
|
|
|
|