Click here to Skip to main content
15,887,414 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: #define not const? Pin
«_Superman_»20-Oct-11 2:19
professional«_Superman_»20-Oct-11 2:19 
AnswerRe: #define not const? Pin
Stefan_Lang21-Oct-11 2:55
Stefan_Lang21-Oct-11 2:55 
QuestionPlaying video in particular dimensions Pin
VCProgrammer19-Oct-11 1:55
VCProgrammer19-Oct-11 1:55 
AnswerRe: Playing video in particular dimensions Pin
enhzflep19-Oct-11 2:35
enhzflep19-Oct-11 2:35 
QuestionCHtmlView and Windows 7 Pin
Member 810956018-Oct-11 22:57
Member 810956018-Oct-11 22:57 
QuestionTCP Communication Pin
john563218-Oct-11 19:15
john563218-Oct-11 19:15 
AnswerRe: TCP Communication Pin
Goto_Label_18-Oct-11 22:29
Goto_Label_18-Oct-11 22:29 
AnswerRe: TCP Communication Pin
Software_Developer18-Oct-11 22:56
Software_Developer18-Oct-11 22:56 
UDP/TCP hole punching is Communication between two computers without opening ports,
using a third computer to set up the connection

UDP/TCP hole punching is NOT a security violation in any way, even though the name suggests it is.
Once the hole has been punched in the firewall, only connections from the specified client
are accepted through it, it isn't like anyone can get in through the hole.

Get the win32 DLL here:
http://www.cis.nctu.edu.tw/~gis87577/xDreaming/XSTUNT/index.html[^]


It works like this:
C#
A--->proxy --------proxy<---B
                |
                S


Let A be the client requesting the connection

Let B be the client that is responding to the request

Let S be the server that they contact to initiate the connection



A sends a connection request to S

S responds with B's IP and port info, and sends A's IP and port info to B

A sends a UDP/TCP packet to B, which B's router firewall drops but it still punches a hole in A's own firewall where B can connect

B sends a UDP/TCP packet to A, that both punches a hole in their own firewall, and reaches A through the hole that they punched in their own firewall

A and B can now communicate through their established connection without the help of S



All this does is make both A and B's firewalls think that they have initiated the connection,
just as it would let packets from a web server through ONLY if the client had initiated the connection
to the web server and the packets were expected.

This is not a security risk and software that uses this method should not be looked down upon,
this is how p2p software like AIM and most VoIP clients initiate connections.



TCP hole punching Algorithm

Let A and B be the two hosts, each in its own private network;
N1 and N2 are the two NAT devices;
S is a public server with a well-known globally reachable IP address.
A and B each begin a TCP conversation with S;
the NAT devices N1 and N2 create TCP translation states and assign temporary external port numbers
S relays these port numbers back to A and B
A and B contact each others' NAT devices directly on the translated ports;
the NAT devices use the previously created translation states and send the packets to A and B

The Low TTL is calculated as follow:

C#
Send SYN with TTL of i=1
Wait for ICMP TTL Exceeded message
i = i + 1, loop
Loop until "ICMP TTL Exceeded" messages are no longer received. 
The own NAT host has been traversed. 
The LOW TTL Value = i + 1.
If the NAT host supports "ICMP TTL Exceeded" messages to internal hosts, then the RST reply from buddy can be inspected. 
The LOW TTL Value = i - 1.




http://en.wikipedia.org/wiki/TCP_hole_punching

http://nutss.gforge.cis.cornell.edu/stunt.php


http://en.wikipedia.org/wiki/STUN
GeneralRe: TCP Communication Pin
john563218-Oct-11 23:45
john563218-Oct-11 23:45 
AnswerRe: TCP Communication Pin
App_18-Oct-11 23:07
App_18-Oct-11 23:07 
AnswerRe: TCP Communication Pin
jschell19-Oct-11 8:55
jschell19-Oct-11 8:55 
QuestionBeginPaint issues Pin
Waldermort18-Oct-11 9:08
Waldermort18-Oct-11 9:08 
AnswerRe: BeginPaint issues Pin
TheGreatAndPowerfulOz18-Oct-11 12:22
TheGreatAndPowerfulOz18-Oct-11 12:22 
GeneralRe: BeginPaint issues Pin
Waldermort18-Oct-11 21:00
Waldermort18-Oct-11 21:00 
GeneralRe: BeginPaint issues Pin
TheGreatAndPowerfulOz19-Oct-11 5:01
TheGreatAndPowerfulOz19-Oct-11 5:01 
AnswerRe: BeginPaint issues Pin
Chuck O'Toole18-Oct-11 12:52
Chuck O'Toole18-Oct-11 12:52 
GeneralRe: BeginPaint issues Pin
Waldermort18-Oct-11 21:03
Waldermort18-Oct-11 21:03 
GeneralRe: BeginPaint issues Pin
Chuck O'Toole18-Oct-11 23:04
Chuck O'Toole18-Oct-11 23:04 
GeneralRe: BeginPaint issues Pin
Waldermort19-Oct-11 3:46
Waldermort19-Oct-11 3:46 
GeneralRe: BeginPaint issues Pin
Chuck O'Toole19-Oct-11 5:02
Chuck O'Toole19-Oct-11 5:02 
GeneralRe: BeginPaint issues Pin
Waldermort19-Oct-11 5:41
Waldermort19-Oct-11 5:41 
Questionselect and accept socket calls Pin
vikramlinux18-Oct-11 8:33
vikramlinux18-Oct-11 8:33 
AnswerRe: select and accept socket calls Pin
Richard Andrew x6418-Oct-11 8:39
professionalRichard Andrew x6418-Oct-11 8:39 
AnswerRe: select and accept socket calls Pin
Chuck O'Toole18-Oct-11 10:37
Chuck O'Toole18-Oct-11 10:37 
QuestionHow to use a collection Pin
jkirkerx18-Oct-11 7:45
professionaljkirkerx18-Oct-11 7:45 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.