Class TransportLayer
- public class TransportLayer
- This class builds the messages needed for the communication. It takes the query , id etc and builds the messages according to our protocol
sendQuery
public void sendQuery(Connection aChannel,
java.lang.String query,
int id)
- Builds and Sends a query message
- Parameters:
aChannel
- A connection on which this msg is sent
query
-
id
-
- Returns:
- Returns the Query message
sendReply
public void sendReply(Connection aChannel,
java.lang.String reply,
int id,
java.lang.String ip,
int port)
- Builds and Sends a reply message
- Parameters:
aChannel
- A connection on which this msg is sent
reply
- Reply from the servent
id
- Id of the query and corresponding response
ip
- Ip address of the replying servent
port
- Port number on which the servent is listening.
sendQFail
public void sendQFail(Connection aChannel,
int id)
- Builds and Sends a query fail message
- Parameters:
aChannel
- A connection on which this msg is sent
id
- Id of the query failed
sendAPing
public void sendAPing(Connection aChannel)
- Builds and sends a ping message
- Parameters:
aChannel
- A connection on which this msg is sent
ip
- Ip addr of the servent which is pinging.
sendHostCache
public void sendHostCache(Connection aChannel,
java.util.Vector hostCache)
- Builds and sends host cache message
- Parameters:
aChannel
- A connection on which this msg is sent
hostCache
- a set of ip addresses of servents it knows.
sendADTim
public void sendADTim(Connection aChannel,
java.lang.String ip,
int time)
- Builds and sends adtim message
- Parameters:
aChannel
- A connection on which this msg is sent
ip
- Ipaddr of the sender