Ejemplo n.º 1
0
 /// <summary>
 ///
 /// </summary>
 /// <param name="port_rec">本机port</param>
 /// <param name="send_ip">对方ip</param>
 /// <param name="port_snd">对方port</param>
 /// <returns></returns>
 public NetWorkerUDP(int port_rec, string send_ip, int port_snd)
 {
     this.UDP_Rec = new UdpReceiveSocket(port_rec);
     this.UDP_Rec.OnDataReceived += new EventHandler <SocketAsyncEventArgs>(this.OnDataReceived);
     this.UDP_Snd = new UdpSendSocket(10000);
     this.UDP_Snd.Init();
     this.TerminalEpt = new IPEndPoint(IPAddress.Parse(send_ip), port_snd);
 }
    void Start()
    {
#if !UNITY_EDITOR && UNITY_WSA
        upClient = new UdpClient();
#else
        udpSendSocket    = new UdpSendSocket();
        udpReceiveSocket = new UdpReceiveSocket();
#endif
    }
 private void Start()
 {
     udpSendSocket    = new UdpSendSocket();
     udpReceiveSocket = new UdpReceiveSocket();
     helperContainer  = new GameObject("HelperContainer");
 }