**
c#端口转发 方法二
**
一:
问题解决
-
新增端口转发:
首先打开命令提示符(cmd)
netsh interface portproxy add v4tov4 listenport=监听端口 connectaddress=转发到的地址 connectport=转发到的端口
例子: netsh interface portproxy add v4tov4 listenport=3340 listenaddress=10.1.1.110 connectport=3389 connectaddress=10.1.1.110 -
查看转发了哪些端口
netsh interface portproxy show all -
删除转发规则
netsh interface portproxy delete v4tov4 listenaddress=192.168.88.110 listenport=9988
二:
static void Main(string[] args)
{
//@JSKI_17761263313
//默认 127.0.0.1:8080 转发到 127.0.0.1:80
var dk = new DuanKou("0.0.0.0",8080,"0.0.0.0",80);
dk.Run();
Console.ReadKey();
}
/// <summary>
/// user => tcp1 => tcp2
/// </summary>
public class DuanKou
{
int localProt {
get; set; }
string localIp {
get; set; }
int TargetPort {
get; set; }
string TargetIp {
get; set; }
public DuanKou(string localIp,int localProt, strin