コード例 #1
0
 public UDPOutputStream(ConnectionUDP conn)
 {
     this.conn    = conn;
     this.dstIp   = conn.dstIp;
     this.dstPort = conn.dstPort;
     this.sender  = conn.sender;
 }
コード例 #2
0
        public void addTask(ConnectionUDP conn, int sequence)
        {
            ResendItem ri = new ResendItem(conn, sequence);

            ri.setResendTime(getNewResendTime(conn));
            taskList.Enqueue(ri);
        }
コード例 #3
0
 void removeConnection(ConnectionUDP conn)
 {
     lock (syn_connTable)
     {
         connTable.Remove(conn.connectId);
     }
 }
コード例 #4
0
 void addConnection(ConnectionUDP conn)
 {
     lock (syn_connTable)
     {
         connTable.Add(conn.connectId, conn);
     }
 }
コード例 #5
0
ファイル: Receiver.cs プロジェクト: rusterx/finalspeed-csharp
 public Receiver(ConnectionUDP conn)
 {
     this.conn    = conn;
     uis          = new UDPInputStream(conn);
     this.sender  = conn.sender;
     this.dstIp   = conn.dstIp;
     this.dstPort = conn.dstPort;
 }
コード例 #6
0
ファイル: Sender.cs プロジェクト: rusterx/finalspeed-csharp
 public Sender(ConnectionUDP conn)
 {
     this.conn    = conn;
     uos          = new UDPOutputStream(conn);
     receiver     = conn.receiver;
     this.dstIp   = conn.dstIp;
     this.dstPort = conn.dstPort;
 }
コード例 #7
0
 void addLastRead(ConnectionUDP conn)
 {
     lock (this)
     {
         if (!taskTable.ContainsKey(conn.connectId))
         {
             AckListTask at = new AckListTask(conn);
             taskTable.Add(conn.connectId, at);
         }
     }
 }
コード例 #8
0
        long getNewResendTime(ConnectionUDP conn)
        {
            int delayAdd = conn.clientControl.pingDelay + (int)((float)conn.clientControl.pingDelay * RUDPConfig.reSendDelay);

            if (delayAdd < RUDPConfig.reSendDelay_min)
            {
                delayAdd = RUDPConfig.reSendDelay_min;
            }
            long time = (long)(DateTime.Now.Millisecond + delayAdd);

            return(time);
        }
コード例 #9
0
 void addAck(ConnectionUDP conn, int sequence)
 {
     lock (this)
     {
         if (!taskTable.ContainsKey(conn.connectId))
         {
             AckListTask at = new AckListTask(conn);
             taskTable.Add(conn.connectId, at);
         }
         AckListTask at1 = taskTable[conn.connectId];
         at1.addAck(sequence);
     }
 }
コード例 #10
0
        public PortMapProcess(MapClient mapClient, Route route, Socket srcSocket, String serverAddress2, int serverPort2, string password_proxy_md5,
                              string dstAddress, int dstPort)
        {
            this.mapClient     = mapClient;
            this.serverAddress = serverAddress2;
            this.serverPort    = serverPort2;

            this.srcSocket          = srcSocket;
            this.password_proxy_md5 = password_proxy_md5;

            try {
                srcIs = new DataInputStream(srcSocket.getInputStream());
                srcOs = new DataOutputStream(srcSocket.getOutputStream());
                conn  = route.getConnection(serverAddress, serverPort, null);
                tis   = conn.uis;
                tos   = conn.uos;

                JSONObject requestJson = new JSONObject();
                requestJson.put("dst_address", dstAddress);
                requestJson.put("dst_port", dstPort);
                requestJson.put("password_proxy_md5", password_proxy_md5);
                byte[] requestData = requestJson.toJSONString().getBytes("utf-8");
                tos.write(requestData, 0, requestData.length);


                final Pipe p1 = new Pipe();
                final Pipe p2 = new Pipe();


                byte[] responeData = tis.read2();

                String     hs          = new String(responeData, "utf-8");
                JSONObject responeJSon = JSONObject.parseObject(hs);
                int        code        = responeJSon.getIntValue("code");
                String     message     = responeJSon.getString("message");
                String     uimessage   = "";
                if (code == Constant.code_success)
                {
                    Route.es.execute(new Runnable()
                    {
                        @Override
コード例 #11
0
 public void setConn(ConnectionUDP conn)
 {
     this.conn = conn;
 }
コード例 #12
0
 public ResendItem(ConnectionUDP conn, int sequence)
 {
     this.conn     = conn;
     this.sequence = sequence;
 }
コード例 #13
0
 public UDPInputStream(ConnectionUDP conn)
 {
     this.conn = conn;
     receiver  = conn.receiver;
 }
コード例 #14
0
 public AckListTask(ConnectionUDP conn)
 {
     this.conn = conn;
     ackList   = new List <int>();
     set       = new HashSet <int>();
 }
コード例 #15
0
 public void onSendDataPacket(ConnectionUDP conn)
 {
 }