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
Merge requests
!1
updated commands
Code
Review changes
Check out branch
Download
Patches
Plain diff
Merged
updated commands
failure
into
master
Overview
0
Commits
1
Pipelines
0
Changes
3
Merged
arshiam2
requested to merge
failure
into
master
6 years ago
Overview
0
Commits
1
Pipelines
0
Changes
3
Expand
0
0
Merge request reports
Compare
master
master (base)
and
latest version
latest version
34fe3b2d
1 commit,
6 years ago
3 files
+
140
−
48
Inline
Compare changes
Side-by-side
Inline
Show whitespace changes
Show one file at a time
Files
3
Search (e.g. *.vue) (Ctrl+P)
cli/src/commands/initialize.js
0 → 100644
+
45
−
0
Options
// @flow
const
path
=
require
(
"
path
"
);
const
chalk
=
require
(
"
chalk
"
);
const
dgram
=
require
(
"
dgram
"
);
const
process
=
require
(
"
process
"
);
const
handleErrors
=
require
(
"
../utils/handleErrors
"
);
const
PORT
=
5000
;
const
HOST
=
"
172.22.158.17
"
;
const
socket
=
dgram
.
createSocket
({
type
:
"
udp4
"
,
reuseAddr
:
true
});
const
machineToIps
=
{
"
0
"
:
"
172.16.138.158
"
,
"
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
"
};
module
.
exports
.
command
=
"
initialize [number]
"
;
module
.
exports
.
describe
=
"
test commands
"
;
module
.
exports
.
builder
=
(
yargs
:
any
)
=>
yargs
;
socket
.
bind
(
PORT
);
function
sendMessage
(
host
,
number
)
{
const
message
=
Buffer
.
from
(
`initialize`
);
console
.
log
(
host
);
socket
.
send
(
message
,
0
,
message
.
length
,
20000
,
host
,
function
()
{});
}
module
.
exports
.
handler
=
handleErrors
(
async
(
argv
:
{})
=>
{
console
.
log
(
"
Sending message to introducer
"
);
let
number
=
argv
.
number
;
if
(
number
!=
undefined
)
{
await
sendMessage
(
machineToIps
[
number
],
number
);
}
process
.
exit
(
0
);
});
Loading