예제 #1
0
        //    long haveRecvBytes = 0;
        //    boolean isRecv = true;

        //public ReceiveLittle(String addr, int mp, int yp, ReceiveState rs)
        //{
        //    try
        //    {
        //        Date begin;
        //        Date end;
        //        yourAddress = new String(addr);
        //        yourPort = yp;
        //        myPort = mp;
        //        socket = new DatagramSocket(myPort);
        //        socket.setReceiveBufferSize(1024 * 1024 * 5);
        //        receiveState = rs;
        //        //            timerCalRecvSpeed();
        //    }
        //    catch (SocketException ex)
        //    {
        //        //            Logger.getLogger(SendLittle.class.getName()).log(Level.SEVERE, null, ex);
        //        logger.error("{}", ex);
        //    }
        //    catch (IOException ioe)
        //    {
        //        ioe.printStackTrace();
        //    }
        //}
        //public ReceiveLittle(DatagramSocket clientSock, String address, int port, ReceiveState rs)
        //{
        //    // TODO Auto-generated constructor stub
        //    try
        //    {
        //        yourAddress = address;
        //        yourPort = port;
        //        socket = clientSock;
        //        socket.setReceiveBufferSize(1024 * 1024 * 5);
        //        receiveState = rs;
        //    }
        //    catch (SocketException e)
        //    {
        //        // TODO Auto-generated catch block
        //        e.printStackTrace();
        //    }
        //}
        public ReceiveLittle(UdpClient udpClient, IPEndPoint senderEP, ReceiveState rs)
        {
            InitLog4Net();
            udpReceiveClient = udpClient;
            host             = senderEP;
            receiveState     = rs;
            log.Info("建立接收程序");
        }
예제 #2
0
        public ReceiveLittle(UdpClient udpClient, String addr, int senderPort, ReceiveState rs)
        {
            InitLog4Net();
            udpReceiveClient = udpClient;
            IPAddress HostIP = IPAddress.Parse(addr);

            host         = new IPEndPoint(HostIP, senderPort);
            receiveState = rs;
            log.Info("建立接收程序");
        }