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(); }
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; }
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); }