In my possession is a straightforward piece of code titled echo_server.js
. It serves as a server that simply echoes back any text received from the connected client.
var net=require('net');
var server=net.createServer(function (socket) {
socket.on('data', function (data) {
socket.write('server reply '+data);
});
});
server.listen(8888);
To execute this code, I will use $ node echo_server.js
. This snippet establishes a socket on port 8888. Through a new terminal window, I am able to connect to this server by entering the command $ telnet localhost 8888
. Subsequently, I receive the same text as replies, mirroring what was echoed by the server.
The program functions perfectly on Linux but behaves unexpectedly on Windows. Keystrokes are echoed back with each key press. Despite the fact that Node.js is platform agnostic, there seems to be an issue with the telnet
client.
On Ubuntu, running netstat -an | grep 8888
confirms that the server is operational and listening on port 8888. Conversely, on Windows, after executing netstat -an
, it becomes evident that port 8888 is not yet in use.
For conducting experiments within a Windows environment, I rely on my company's laptop. Could their IT policies have imposed restrictions? What steps should I take next?
The comprehensive project can be accessed here