Due 6 Mar 2018
Using the code from class, build a working UDP chat client.
The plan is to:
Remember that chat.js
was our script that accepted user input, client.js
was our script that send data over UDP, and server.js
was our script that received data over UDP and displayed it.
Try and break the problem into steps
client.js
into chat.js
to make it so you can type whatever message you want and send it to a running server.js
appserver.js
so you can send and receive from the same appWe will discuss ports next week, but keep this in mind for the assignment, only one program can listen on a port at any given time on one machine. To make this chat work on the same machine, each program will have to listen on a different port. So, if you have two programs Program A and Program B, Program A can listen on port 3333 and Program B can listen on 4444. In order to communicate, they need to send messaged to each other's ports. So, Program A needs to send to port 4444 (Program B's listening port) and Program B needs to send to port 3333 (Program A's listening port).
You can do this by writing two different .js
files if you like, one for Program A and one for Program B, that has different ports. You will need a new variable to differentiate between listening port and sending port.