Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
C
cs425-mp2
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
arshiam2
cs425-mp2
Commits
51e61150
Commit
51e61150
authored
6 years ago
by
arshiam2
Browse files
Options
Downloads
Patches
Plain Diff
updated join
parent
d85f7428
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
cli/src/commands/join.js
+27
-5
27 additions, 5 deletions
cli/src/commands/join.js
with
27 additions
and
5 deletions
cli/src/commands/join.js
+
27
−
5
View file @
51e61150
...
@@ -11,7 +11,7 @@ module.exports.builder = (yargs: any) => yargs;
...
@@ -11,7 +11,7 @@ module.exports.builder = (yargs: any) => yargs;
const
PORT
=
20000
;
const
PORT
=
20000
;
const
MULTICAST_ADDR
=
"
233.255.255.255
"
;
const
MULTICAST_ADDR
=
"
233.255.255.255
"
;
const
HOST
=
"
172.22.158.1
5
"
;
const
HOST
=
"
172.22.158.1
7
"
;
// const HOST = "fa18-cs425-g05-02.cs.illinois.edu";
// const HOST = "fa18-cs425-g05-02.cs.illinois.edu";
const
dgram
=
require
(
"
dgram
"
);
const
dgram
=
require
(
"
dgram
"
);
...
@@ -22,19 +22,41 @@ const socket = dgram.createSocket({ type: "udp4", reuseAddr: true });
...
@@ -22,19 +22,41 @@ const socket = dgram.createSocket({ type: "udp4", reuseAddr: true });
const
server
=
i
=>
const
server
=
i
=>
`ws://fa18-cs425-g05-
${
String
(
i
).
padStart
(
2
,
"
0
"
)}
.cs.illinois.edu:80`
;
// gets the name of the server
`ws://fa18-cs425-g05-
${
String
(
i
).
padStart
(
2
,
"
0
"
)}
.cs.illinois.edu:80`
;
// gets the name of the server
// 1 : 172.22.156.15
// 2 : 172.22.158.15
// 3 : 172.22.154.16
// 4 : 172.22.156.16
// 5 : 172.22.158.16
// 6 : 172.22.154.17
// 8 : 172.22.158.17
// 9 : 172.22.154.18
// 10: 172.22.156.18
const
machineToIps
=
{
"
1
"
:
"
172.22.156.15
"
,
"
2
"
:
"
172.22.158.15
"
,
"
3
"
:
"
172.22.154.16
"
,
"
4
"
:
"
172.22.156.16
"
,
"
5
"
:
"
172.22.158.16
"
,
"
6
"
:
"
172.22.154.17
"
,
"
8
"
:
"
172.22.158.17
"
,
"
9
"
:
"
172.22.154.18
"
,
"
10
"
:
"
172.22.156.18
"
}
socket
.
bind
(
PORT
);
socket
.
bind
(
PORT
);
function
sendMessage
()
{
function
sendMessage
(
host
)
{
const
message
=
Buffer
.
from
(
`cli
${
process
.
pid
}
`
);
const
message
=
Buffer
.
from
(
`cli
${
process
.
pid
}
`
);
socket
.
send
(
message
,
0
,
message
.
length
,
PORT
,
HOST
,
function
()
{});
console
.
log
(
host
)
socket
.
send
(
message
,
0
,
message
.
length
,
PORT
,
host
,
function
()
{});
}
}
module
.
exports
.
handler
=
handleErrors
(
async
(
argv
:
{})
=>
{
module
.
exports
.
handler
=
handleErrors
(
async
(
argv
:
{})
=>
{
console
.
log
(
"
Sending message to introducer
"
)
console
.
log
(
"
Sending message to introducer
"
)
let
number
=
argv
.
number
let
number
=
argv
.
number
console
.
log
(
server
(
number
))
await
sendMessage
(
machineToIps
[
number
]);
await
sendMessage
();
process
.
exit
(
0
);
process
.
exit
(
0
);
});
});
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment