c#¶ë¿úxª ¢óã ¨ïê½â

Source: Internet
Author: User

±??? Êμày?2ê?á? C#??? Úxa ¢ó? ¨?£?? Í?? ′ó?ò1?′ó?ò2???? £?? ì???? È??? £o

? aà?ò?á′?ó3389μ?ê±oò?aày

Àyxó1£oá?? Óa?ú?÷μ?3389??? úá?2?é?£?òò?a??? À?e??? Ò?? Í?1?x?á?? T?? £???? ü?? Êa?ú?÷μ??? ±e??? Ú±èè?80?£

Àyxó2£oá?? Óa?ú?÷μ??? O?? Ùód??? Ú?? á?2?é?£¨?????? Úí?? ò?? À?e?? Í?1?x?á?? T?? £?£???? Ü1433é?襣?μ?ê??? ·?? Éò?á?? Ó?? Μ?? 3D???? Ú?£

? a??? ¨£o

Μúò?????? Òμ¥£??? dèòa3ìdò?ú???? A80£??? Á?? Ó?? 80£?3ìdòê?μ?êy? yoó£? ¢?íμ??? ±?? Úμ?3389£?í?ê±′ó?? 3389ê?μ?êy? Yoó μ?? Μ???? £3ìdò?íê?ò???? DXA??? £

Using system;using system.net.sockets;using System.threading;namespace porttransponder{class Program {static void M Ain (string[] args) {TcpListener tl = new TcpListener;//?aà?? a???? Éò?±??? Á?? Ó2¢?ò?′±??? ó?μ???? Útl.      Start (); while (true)//?aà?±? D?ó?? -?· £?? Éò?? Óê?2?? 1ò???? Í?§//òò?a?ò ¢?????? · T?? Ódê±ò?????? Ú2? Dd?í?? Ò?????? Ú??      á? {//???? Μ?òa??? Íê?ò?μ?3ìdòê?μ??? · ¢?íμ?êy? Y°ÜOÓÁ¢?Ì?A2???? 3ìx?? DXA try {TcpClient TC1 = tl. AcceptTcpClient ();//?aà?ê?μè′yêy? Y?ù?′dd?? ±?£?2?? á100%??          Ó?CPU TcpClient tc2 = new TcpClient ("localhost", 3389); TC1. Sendtimeout = 300000;//éè?¨3?ê±£??? Ò??? Ú?? Ò?? ±±??? Ó?£?? ′ê1ê§è¥á?? Ótc1.          ReceiveTimeout = 300000; Tc2.          Sendtimeout = 300000; Tc2.          ReceiveTimeout = 300000;          Object obj1 = (object) (new tcpclient[] {TC1, tc2});          Object obj2 = (object) (new tcpclient[] {tc2, TC1});          ThreadPool.QueueUserWorkItem (new WaitCallback (transfer), obj1); ThreaDpool.queueuserworkitem (new WaitCallback (transfer), OBJ2);       } Catch {}}} public static void Transfer (Object obj) {TcpClient TC1 = ((tcpclient[]) obj) [0];      TcpClient TC2 = ((tcpclient[]) obj) [1]; NetworkStream ns1 = Tc1.      GetStream (); NetworkStream ns2 = tc2.      GetStream (); while (true) {try {//?aà?±? D?try catch£??? Òá?? Óò?μ?? D?? 3ìdò?í±àà£á?//òaê?μˉ3?′í?óìáê?è?? ú?÷?′????? Í??          á?          byte[] bt = new byte[10240]; int count = ns1. Read (BT, 0, Bt.          Length); Ns2.        Write (BT, 0, Count); } catch {ns1.          Dispose (); Ns2.          Dispose (); TC1.          Close (); Tc2.          Close ();        Break }      }    }  }}

? £í?±???? Ùê??? ′ó?òμ? C#3ìdòéè?? Ód?ù°?? Ú?£

In addition to the Declaration, Running GuestArticles are original, reproduced please link to the form of the address of this article
C#??? Úxa ¢ó? ¨?ê?a

This address: http://www.paobuke.com/develop/c-develop/pbk23101.html






Related content C # development Portal and Applications (2) message processing and Response C # Public number and subscription number interface development sample Code C # read-write app.config,configurationmanager.appsettings not effective solution C # prohibits textbox copying, How to paste, cut, and right mouse buttons
C # generates CODE39 barcodes instead of barcode fonts C # Writing a Send mail component C # keyboard Mouse hook instance WinForm in TreeView implementation on-demand loading method

c#¶ë¿úxª ¢óã ¨ïê½â

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.