Mercurial > hg > Database > Christie-sharp
view topology/HostMessage.cs @ 59:c4f8630b7822
topology manager fix
author | KaitoMaeshiro <aosskaito@cr.ie.u-ryukyu.ac.jp> |
---|---|
date | Thu, 27 Jan 2022 01:19:51 +0900 |
parents | 0d2c956060d8 |
children | 14222beab95b |
line wrap: on
line source
using System; using System.Net; using System.Collections.Generic; namespace Christie_net.topology { public class HostMessage /*: Cloneable*/ { private String hostName = ""; private int port ; private String nodeName; // this is nodeName which have these IP and port. private String connectionName; private String remoteNodeName; private String cookie; // MD5 private Boolean alive; public HostMessage() {} public void setLocalHostAndPort(int port){ try { hostName = InetAddress.getLocalHost().getHostAddress(); this.port = port; } catch (UnknownHostException e) { e.printStackTrace(); } } public void setHostAndPort(HostMessage hostMessage) { setHostAndPort(hostMessage.getHostName(), hostMessage.getPort()); } public void setHostAndPort(String hostName, int port) { this.hostName = hostName; this.port = port; } public void setNodeInfo(String nodeName, String connectionName, String remoteNodeName){ this.nodeName = nodeName; this.connectionName = connectionName; this.remoteNodeName = remoteNodeName; } public void setNodeName(String nodeName) { this.nodeName = nodeName; } public String getHostName() { return hostName; } public int getPort() { return port; } public String getNodeName() { return nodeName; } public String getConnectionName() { return connectionName; } public String getRemoteNodeName() { return remoteNodeName; } public void setAlive(Boolean alive) { this.alive = alive; } public Boolean isAlive() { return alive; } public void setCookie(String cookie) { this.cookie = cookie; } public String getCookie() { return cookie; } public String toString() { return "HostMessage : name = " + hostName + ", port = " + Convert.ToInt32(port) + " connectionName = " + connectionName + " nodeName = " + nodeName + " remoteNodeName = " + remoteNodeName + " cokkie = " + cookie ; } /* public HostMessage clone(){ HostMessage cloneHostMessage = new HostMessage(); try { cloneHostMessage = (HostMessage)super.clone(); }catch (Exception e){ e.printStackTrace(); } return cloneHostMessage; } */ } }