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
d85f7428
Commit
d85f7428
authored
6 years ago
by
arshiam2
Browse files
Options
Downloads
Patches
Plain Diff
getting all the ip addresses
parent
ea8d9448
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
cli/src/commands/join.js
+7
-1
7 additions, 1 deletion
cli/src/commands/join.js
inroducer/index.js
+4
-1
4 additions, 1 deletion
inroducer/index.js
with
11 additions
and
2 deletions
cli/src/commands/join.js
+
7
−
1
View file @
d85f7428
...
...
@@ -12,12 +12,18 @@ module.exports.builder = (yargs: any) => yargs;
const
PORT
=
20000
;
const
MULTICAST_ADDR
=
"
233.255.255.255
"
;
const
HOST
=
"
172.22.158.15
"
;
// const HOST = "fa18-cs425-g05-02.cs.illinois.edu";
const
dgram
=
require
(
"
dgram
"
);
const
process
=
require
(
"
process
"
);
const
socket
=
dgram
.
createSocket
({
type
:
"
udp4
"
,
reuseAddr
:
true
});
const
server
=
i
=>
`ws://fa18-cs425-g05-
${
String
(
i
).
padStart
(
2
,
"
0
"
)}
.cs.illinois.edu:80`
;
// gets the name of the server
socket
.
bind
(
PORT
);
function
sendMessage
()
{
...
...
@@ -28,7 +34,7 @@ function sendMessage() {
module
.
exports
.
handler
=
handleErrors
(
async
(
argv
:
{})
=>
{
console
.
log
(
"
Sending message to introducer
"
)
let
number
=
argv
.
number
console
.
log
(
number
)
console
.
log
(
server
(
number
)
)
await
sendMessage
();
process
.
exit
(
0
);
});
This diff is collapsed.
Click to expand it.
inroducer/index.js
+
4
−
1
View file @
d85f7428
...
...
@@ -13,6 +13,9 @@ const socket = dgram.createSocket({ type: "udp4", reuseAddr: true });
socket
.
bind
(
PORT
);
socket
.
on
(
"
listening
"
,
function
()
{
socket
.
addMembership
(
MULTICAST_ADDR
);
socket
.
setBroadcast
(
true
)
...
...
@@ -33,5 +36,5 @@ function sendMessage() {
}
socket
.
on
(
"
message
"
,
function
(
message
,
rinfo
)
{
//
console.info(`Message from: ${rinfo.address}:${rinfo.port} - ${message}`);
console
.
info
(
`Message from:
${
rinfo
.
address
}
:
${
rinfo
.
port
}
-
${
message
}
`
);
});
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