You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
// TODO: If no Routers are active, save Client details and notify once a Router is connected
106
-
if(!firstRouter)returnsendMessage={message: "No Routers active on Network"};
107
-
elseif(clientCount==0){
108
-
console.log("Initial Client Connected");
109
-
sendMessage=JSON.parse(firstRouter);
110
-
}elseif(clientCount==1){
111
-
console.log("Receiving Client Connected");
112
-
// Store Client details for later use by last router
113
-
receivingClient.ip=address;
114
-
receivingClient.port=port;
115
-
sendMessage="You are the receiving Client";
116
-
}else{
117
-
console.log("Additional Client connected, no space in Flow Table");
118
-
sendMessage="You are not connected to the Network, no space.";
101
+
// Get first Router in Routers list
102
+
varit=Routers.values();
103
+
104
+
letfirstRouter=it.next().value;
105
+
if(!firstRouter)returnsendMessage={message: "No Routers active on Network"};
106
+
elseif(clientCount==0){
107
+
console.log("Initial Client Connected");
108
+
sendMessage={message: 'You are the initial client. Router 1 has been detected on the Switcher Network',router: JSON.parse(firstRouter),count: clientCount};
109
+
}elseif(clientCount==1){
110
+
console.log("Receiving Client Connected");
111
+
112
+
// Get Flow Table values for Receiving Client and update with address and port
0 commit comments