-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathTCPConnection.java
More file actions
77 lines (66 loc) · 1.38 KB
/
Copy pathTCPConnection.java
File metadata and controls
77 lines (66 loc) · 1.38 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
import java.util.ArrayList;
class TCPConnection
{
private double startTime;
private String serverIP, clientIP;
private int serverPort, clientPort;
public int sendSize, recvSize;
private ArrayList<Long> seq, ack;
private ArrayList<Double> seqTime, ackTime;
TCPConnection(double t, String a, String b, int x, int y, int s1, int s2)
{
startTime = t;
serverIP = a;
clientIP = b;
serverPort = x;
clientPort = y;
sendSize = s1;
recvSize = s2;
seq = new ArrayList<>();
ack = new ArrayList<>();
seqTime = new ArrayList<>();
ackTime = new ArrayList<>();
}
public boolean isConn(String x, int a, String y, int b)
{
return (x.equals(serverIP) && y.equals(clientIP) && b==clientPort && a==serverPort) || (y.equals(serverIP) && x.equals(clientIP) && a==clientPort && b==serverPort);
}
public double getTime()
{
return startTime;
}
public boolean isServer(String x, int y)
{
return x.equals(serverIP) && y==serverPort;
}
public void addSeq(long l, double t)
{
seq.add(l);
seqTime.add(t);
}
public void addAck(long l, double t)
{
ack.add(l);
ackTime.add(t);
}
public int getSize()
{
return sendSize + recvSize;
}
public ArrayList<Long> getSeq()
{
return seq;
}
public ArrayList<Long> getAck()
{
return ack;
}
public ArrayList<Double> getSeqTime()
{
return seqTime;
}
public ArrayList<Double> getAckTime()
{
return ackTime;
}
}