Esempio n. 1
0
 public void Init()
 {
     s = new DatagramSocket();
     s.MessageReceived += S_MessageReceived;
     s.BindEndpointAsync(new HostName("127.0.0.1"), port).AsTask().Wait();
     s.ConnectAsync(new HostName("127.0.0.1"), "9007").AsTask().Wait();
     tun?.Init();
 }
Esempio n. 2
0
 public void Init(string port)
 {
     s = new DatagramSocket();
     s.MessageReceived += S_MessageReceived;
     s.BindEndpointAsync(new HostName("127.0.0.1"), "9008").AsTask().Wait();
     s.ConnectAsync(new HostName("127.0.0.1"), "9007").AsTask().Wait();
     tun.Init();
     tun.PacketPoped += Tun_PacketPoped;
 }
Esempio n. 3
0
        public int Init(int pluginPort)
        {
            u = new UdpClient();
            u.Client.Bind(new IPEndPoint(pluginEndpoint.Address, 0));
            tunEndpoint = ((IPEndPoint)u.Client.LocalEndPoint).Port;
#if !YT_MOCK
            pluginEndpoint.Port = pluginPort;
            // s = new DatagramSocket();
            // s.MessageReceived += S_MessageReceived;
            // s.BindEndpointAsync(new HostName("127.0.0.1"), port).AsTask().Wait();
            // s.ConnectAsync(new HostName("127.0.0.1"), "9007").AsTask().Wait();
            tun?.Init();
            // StartRecv();
#endif
            outPackets = Channel.CreateUnbounded <byte[]>();
            return(tunEndpoint);
        }