-
-
Save anonymous/3b8164854ca87652725b to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
using System.Collections.Generic; | |
using System.Linq; | |
using System.Text; | |
using System.Threading.Tasks; | |
using System.Net.Sockets; | |
namespace TCPPunch | |
{ | |
class Program | |
{ | |
static void Main(string[] args) | |
{ | |
var port = 4119; | |
var l = new TcpListener(System.Net.IPAddress.Any, port); | |
l.Start(); | |
try | |
{ | |
var o = new TcpClient(new System.Net.IPEndPoint(System.Net.IPAddress.Any, port)); | |
var sdf = o.Client.LocalEndPoint; | |
o.Connect("mysite.com", 80); | |
} | |
catch(Exception ee) { | |
} | |
var e = l.AcceptSocket(); | |
Console.WriteLine(e.RemoteEndPoint.AddressFamily); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment