public UDPOutputStream(ConnectionUDP conn) { this.conn = conn; this.dstIp = conn.dstIp; this.dstPort = conn.dstPort; this.sender = conn.sender; }
public void addTask(ConnectionUDP conn, int sequence) { ResendItem ri = new ResendItem(conn, sequence); ri.setResendTime(getNewResendTime(conn)); taskList.Enqueue(ri); }
void removeConnection(ConnectionUDP conn) { lock (syn_connTable) { connTable.Remove(conn.connectId); } }
void addConnection(ConnectionUDP conn) { lock (syn_connTable) { connTable.Add(conn.connectId, conn); } }
public Receiver(ConnectionUDP conn) { this.conn = conn; uis = new UDPInputStream(conn); this.sender = conn.sender; this.dstIp = conn.dstIp; this.dstPort = conn.dstPort; }
public Sender(ConnectionUDP conn) { this.conn = conn; uos = new UDPOutputStream(conn); receiver = conn.receiver; this.dstIp = conn.dstIp; this.dstPort = conn.dstPort; }
void addLastRead(ConnectionUDP conn) { lock (this) { if (!taskTable.ContainsKey(conn.connectId)) { AckListTask at = new AckListTask(conn); taskTable.Add(conn.connectId, at); } } }
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); }
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); } }
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
public void setConn(ConnectionUDP conn) { this.conn = conn; }
public ResendItem(ConnectionUDP conn, int sequence) { this.conn = conn; this.sequence = sequence; }
public UDPInputStream(ConnectionUDP conn) { this.conn = conn; receiver = conn.receiver; }
public AckListTask(ConnectionUDP conn) { this.conn = conn; ackList = new List <int>(); set = new HashSet <int>(); }
public void onSendDataPacket(ConnectionUDP conn) { }