root / src / messages / PingMessage.java @ 1
History | View | Annotate | Download (722 Bytes)
1 |
package messages; |
---|---|
2 |
|
3 |
import chord.ConnectionInfo; |
4 |
|
5 |
public class PingMessage extends Message{ |
6 |
|
7 |
private ConnectionInfo ci;
|
8 |
private String ipAddress; |
9 |
private int port; |
10 |
|
11 |
public PingMessage(ConnectionInfo ci,String ipAddress,int port){ |
12 |
this.ci = ci;
|
13 |
this.ipAddress = ipAddress;
|
14 |
this.port = port;
|
15 |
} |
16 |
|
17 |
@Override
|
18 |
public void handleMessage() { |
19 |
MessageForwarder.sendMessage(new PongMessage( ci.getIp(), ci.getPort()));
|
20 |
} |
21 |
|
22 |
@Override
|
23 |
public String toString() { |
24 |
return "PING " + this.ci; |
25 |
} |
26 |
@Override
|
27 |
public String getIpAddress() { |
28 |
return this.ipAddress; |
29 |
} |
30 |
|
31 |
@Override
|
32 |
public int getPort() { |
33 |
return this.port; |
34 |
} |
35 |
} |