狠狠色丁香婷婷综合尤物/久久精品综合一区二区三区/中国有色金属学报/国产日韩欧美在线观看 - 国产一区二区三区四区五区tv

LOGO OA教程 ERP教程 模切知識交流 PMS教程 CRM教程 開發(fā)文檔 其他文檔  
 
網(wǎng)站管理員

c# 實(shí)現(xiàn)端口轉(zhuǎn)發(fā)可以用來實(shí)現(xiàn)遠(yuǎn)程桌面連接內(nèi)網(wǎng)主機(jī)

admin
2018年2月10日 11:1 本文熱度 7590
gYP.Start()方法調(diào)用后填寫一臺(tái)公網(wǎng)主機(jī)ip和端口(11111)然后公網(wǎng)主機(jī)用lcx轉(zhuǎn)發(fā)11111到22222端口,遠(yuǎn)程桌面在公網(wǎng)主機(jī)連自己(127.0.0.1:22222)的22222端口就可以了可能需要點(diǎn)2次連接

 protected void wDZ(object sender, EventArgs e)
        {
            if (iXdh.Text == "" ││ eEpm.Text.Length < 7 ││ ZHS.Text == "") return;
            PortForward gYP = new PortForward();
            gYP.Start(llH.Text, int.Parse(ZHS.Text), eEpm.Text, int.Parse(iXdh.Text));         
        }
        protected void vJNsE(object sender, EventArgs e)
        {
            PortForward gYP = new PortForward();
            gYP.lyTOK();
          
        }
        protected void tYoZ(object sender, EventArgs e)
        {
        }
    }
  
    public class PortForward
    {
        public string Localaddress;
        public int LocalPort;
        public string RemoteAddress;
        public int RemotePort;
        string type;
        Socket ltcpClient;
        Socket rtcpClient;
        Socket server;
        byte[] DPrPL = new byte[2048];
        byte[] wvZv = new byte[2048];
        public struct session
        {
            public Socket rdel;
            public Socket ldel;
            public int llen;
            public int rlen;
        }
        public static IPEndPoint mtJ(string host, int port)
        {
            IPEndPoint iep = null;
            IPHostEntry aGN = Dns.Resolve(host);
            IPAddress rmt = aGN.AddressList[0];
            iep = new IPEndPoint(rmt, port);
            return iep;
        }
        public void Start(string Rip, int Rport, string lip, int lport)
        {
            try
            {
                LocalPort = lport;
                RemoteAddress = Rip;
                RemotePort = Rport;
                Localaddress = lip;
                rtcpClient = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp);
                ltcpClient = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp);
                rtcpClient.BeginConnect(mtJ(RemoteAddress, RemotePort), new AsyncCallback(iiGFO), rtcpClient);
            }
            catch (Exception ex) { }
        }
        protected void iiGFO(IAsyncResult ar)
        {
            try
            {
                session RKXy = new session();
                RKXy.ldel = ltcpClient;
                RKXy.rdel = rtcpClient;
                ltcpClient.BeginConnect(mtJ(Localaddress, LocalPort), new AsyncCallback(VTp), RKXy);
            }
            catch (Exception ex) { }
        }

        protected void VTp(IAsyncResult ar)
        {
            try
            {
                session RKXy = (session)ar.AsyncState;
                ltcpClient.EndConnect(ar);
                RKXy.rdel.BeginReceive(DPrPL, 0, DPrPL.Length, SocketFlags.None, new AsyncCallback(LFYM), RKXy);
                RKXy.ldel.BeginReceive(wvZv, 0, wvZv.Length, SocketFlags.None, new AsyncCallback(xPS), RKXy);
            }
            catch (Exception ex) { }
        }
        private void LFYM(IAsyncResult ar)
        {
            try
            {
                session RKXy = (session)ar.AsyncState;
                int Ret = RKXy.rdel.EndReceive(ar);
                if (Ret > 0)
                    ltcpClient.BeginSend(DPrPL, 0, Ret, SocketFlags.None, new AsyncCallback(JTcp), RKXy);
                else lyTOK();
            }
            catch (Exception ex) { }
        }
        private void JTcp(IAsyncResult ar)
        {
            try
            {
                session RKXy = (session)ar.AsyncState;
                RKXy.ldel.EndSend(ar);
                RKXy.rdel.BeginReceive(DPrPL, 0, DPrPL.Length, SocketFlags.None, new AsyncCallback(this.LFYM), RKXy);
            }
            catch (Exception ex) { }
        }
        private void xPS(IAsyncResult ar)
        {
            try
            {
                session RKXy = (session)ar.AsyncState;
                int Ret = RKXy.ldel.EndReceive(ar);
                if (Ret > 0)
                    RKXy.rdel.BeginSend(wvZv, 0, Ret, SocketFlags.None, new AsyncCallback(IZU), RKXy);
                else lyTOK();
            }
            catch (Exception ex) { }
        }
        private void IZU(IAsyncResult ar)
        {
            try
            {
                session RKXy = (session)ar.AsyncState;
                RKXy.rdel.EndSend(ar);
                RKXy.ldel.BeginReceive(wvZv, 0, wvZv.Length, SocketFlags.None, new AsyncCallback(this.xPS), RKXy);
            }
            catch (Exception ex) { }
        }
        public void lyTOK()
        {
            try
            {
                if (ltcpClient != null)
                {
                    ltcpClient.Close();
                }
                if (rtcpClient != null)
                    rtcpClient.Close();
            }
            catch (Exception ex) { }
        }
    }
}

該文章在 2018/2/10 11:02:23 編輯過
關(guān)鍵字查詢
相關(guān)文章
正在查詢...
點(diǎn)晴ERP是一款針對中小制造業(yè)的專業(yè)生產(chǎn)管理軟件系統(tǒng),系統(tǒng)成熟度和易用性得到了國內(nèi)大量中小企業(yè)的青睞。
點(diǎn)晴PMS碼頭管理系統(tǒng)主要針對港口碼頭集裝箱與散貨日常運(yùn)作、調(diào)度、堆場、車隊(duì)、財(cái)務(wù)費(fèi)用、相關(guān)報(bào)表等業(yè)務(wù)管理,結(jié)合碼頭的業(yè)務(wù)特點(diǎn),圍繞調(diào)度、堆場作業(yè)而開發(fā)的。集技術(shù)的先進(jìn)性、管理的有效性于一體,是物流碼頭及其他港口類企業(yè)的高效ERP管理信息系統(tǒng)。
點(diǎn)晴WMS倉儲(chǔ)管理系統(tǒng)提供了貨物產(chǎn)品管理,銷售管理,采購管理,倉儲(chǔ)管理,倉庫管理,保質(zhì)期管理,貨位管理,庫位管理,生產(chǎn)管理,WMS管理系統(tǒng),標(biāo)簽打印,條形碼,二維碼管理,批號管理軟件。
點(diǎn)晴免費(fèi)OA是一款軟件和通用服務(wù)都免費(fèi),不限功能、不限時(shí)間、不限用戶的免費(fèi)OA協(xié)同辦公管理系統(tǒng)。
Copyright 2010-2025 ClickSun All Rights Reserved