Creating a client-server application in JavaScript with the npm-net module

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

Answer №1

After conducting thorough research and delving into numerous discussions on github, I have gained insight into the issues surrounding telnet in both Windows and Linux operating systems. It appears that using a Windows telnet client can result in the mentioned problem, whereas utilizing a telnet client in Linux buffers keystrokes until the ENTER key is pressed. Alternatively, one could develop a custom client program to communicate with the server instead of relying on telnet. Rest assured, I am actively working towards resolving this issue.

Similar questions

If you have not found the answer to your question or you are interested in this topic, then look at other similar questions below or use the search

error in assetic:watch - unserialize(): Offset error detected

While working on my project using everyday assetic in work (OS: Win7), I encountered an error today when I ran the command: php bin/console assetic:watch. The error message I received was: [Symfony\Component\Debug\Exception\ContextEr ...

Ways to store information in variables and use it across different blocks in Cypress

Is it feasible to store data in variables and reuse them in other blocks within Cypress.io? For instance, imagine I have a unique name for a device. I aim to retrieve this information and then verify if the title in a new window includes that particular de ...

Issues with integrating the jsPDF package into a JavaScript project

I'm struggling to solve this issue. I've been attempting to create a program that can download a pdf from a webpage using the jsPDF npm module. After downloading it, I tried importing it in two different ways: Using the node.js require statemen ...

Seeking out a particular key within a JSON object and then finding a match based on the id within that key's array - how can it be

Recently, I've been exploring JavaScript and encountering challenges when trying to apply array methods on objects. For instance, I received a fetch response and my goal is to extract the 'entries' key and then utilize the native Array.find( ...

Graph columns failing to display on Chart.js bar chart

I'm currently facing a challenge while trying to create a bar chart using HTML and JavaScript. Unfortunately, the bars are not showing up for some reason. I have included the code snippet below along with an imagehttps://i.stack.imgur.com/4H7ol.png. ...

Sinopia, the database for your local NPM registry

Sinopia caught my attention with its feature of having a local npm registry. I have some queries regarding this module: The Sinopia Documentation states that "Sinopia keeps its own small database"; but what specific database is actually being used? Addit ...

Encountering an issue with extending the MUI color palette, receiving a "reading 'dark'" error due to properties of undefined

Encountering an issue when trying to expand the MUI color palette—getting this error instead: Error: Cannot read properties of undefined (reading 'dark') Take a look at my theme.ts file below: const theme = createTheme({ palette: { pri ...

"Utilizing Jquery for interactive menu functionality - delivering the requested JSON

I have successfully implemented a dynamic menu using jQuery that parses a JSON response file to create the menu. However, instead of having the menu items link to URLs, I want them to retrieve and parse JSON data from those URLs. Despite my efforts, the me ...

Tips for personalizing your Compodoc Angular documentation

I've been experimenting with adding extra side navigation menus to the current compodoc documentation. Here's an example of how I tried to accomplish this: menu-wc.js <li class="link"> <a href="dependencies.html" data-type="chapte ...

Guide on transferring control from a successful jQuery event to an HTML form

I am currently using the following jQuery code to validate user details. $.ajax({ type: "POST", url: "Login", data:'uname='+encodeURIComponent(uname)+'&'+'pass='+encodeURIComponent(pass), ...

The command npm/cucumber - '.' is not recognized as a valid internal or external command

I recently installed npm and it's showing version 9.2.0. But when I try to run the command npm run test, I encounter an error stating that '.' is not recognized as an internal or external command. I have double-checked my environment variabl ...

How can I allow users to select multiple files with just one input?

Currently, I am able to retrieve a single file from a single input using the following code: $scope.$on("fileSelected", function (event, args) { $scope.$apply(function () { $scope.files.push(args.file); ...

Automatically Assigning a Default Value to a Column Using SEQUELIZE ORM

When fetching data from a database using Sequelize ORM, I need to set a default value. Here is an example of the SQL query: SELECT a.affiliate_id, a.active AS current_state, IF(MAX(cn.contract_id) IS NULL ,0, IF(DATEDIFF(NOW(),MAX(cn.contract_date) ...

The react-key-index demonstration isn't functioning properly

Looking to utilize the react-key-index extension for generating unique ids, I attempted to follow their sample example. However, despite my efforts, I keep encountering the same error: TypeError: Hashids is not a constructor Source Link: react-key-inde ...

Firefox displays an error when using jQuery.load(), but Chrome functions properly without any issues

I have created a function that opens a page in a dialog box instead of the main window. The code has been cleaned up and here is the revised version: var baseUrl = window.location.origin + '/static/docs/'; function handleLinkClick(event) { ev ...

developing a dropdown menu feature

I'm struggling with a small issue related to my drop-down menu function. My goal is to hide the visibility of a menu tab after it has been clicked for the second time. Below is the code snippet I've been working on: HTML:- <nav class="clea ...

Is it Possible for Angular Layout Components to Render Content Correctly even with Deeply Nested ng-container Elements?

Within my Angular application, I have designed a layout component featuring two columns using CSS. Within this setup, placeholders for the aside and main content are defined utilizing ng-content. The data for both the aside and main sections is fetched fr ...

Refreshing the child component based on the child's action and sending information to the parent in a React application

Within my Parent Component, I am utilizing an Ajax call to populate two children Components. C1 requires the data only once, while C2 has the ability to fetch additional data through subsequent Ajax calls and needs to render accordingly. I find it more co ...

Activate the ajax function using a specific reference

I have been working on creating an ajax function that contains all the data inside the variable called $item within the following function: public function handleAjaxData(&$item,&$params,$limitstart) { $view = JRequest::getVar('view' ...

Sending Emails with AngularJS

Exploring AngularJs has been a delightful experience for me, and I recently stumbled upon a fantastic plugin for Angular called angular-http-auth. This plugin allows you to seamlessly integrate an identification system. Does anyone know of a similar resou ...