Hear the local server on two distinct ports

Is it possible to listen to localhost with two different ports simultaneously?

I am running two local servers (two win32 exe's) within a single script, as illustrated below:

Server 1: exe 1

xmr = new XMLHttpRequest();
xmr.open("POST", "http://127.0.0.1:5007/?command=init&comport=com2", true);

Server 2: exe 2

xmr = new XMLHttpRequest();
xmr.open("POST", "http://127.0.0.1:5009/?command=init&comport=com5&", true);

When I start the first server followed by the second one in the script, the first one initializes successfully, but the second one fails to connect to the port and displays an error like this:

POST http://127.0.0.1:5009/?command=init&comport=com5& net::ERR_CONNECTION_REFUSED

How can I handle such a situation effectively?

Note: This is my first experience with Tcp/IP programming. Apologies for any language errors. Any explanations or sample code would be greatly appreciated.

Answer №1

Ensure the proper configuration of ports in IIS.

To do this, follow these steps: - Navigate to IIS -> Website -> Bindings and add the necessary ports under HTTPhttps://i.sstatic.net/AUst0.png

Please see the attached screenshot for reference.

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

Custom AngularJS directive: dynamic template rendering using scope value (ng-bind-html)

I am currently working on a directive which looks like this: ... template: function(element, attrs) { var htmlTemplate = '<div class="start-it" ng-if="isVisible">\ <p ng-bind-html="\'{{customDynamicText}}\&a ...

Launch a new window with the window.open() method and execute a function on the newly opened window

I am having trouble generating a barcode in a new window using the barcode generator script. Despite trying to use window.focus(), I can't get the barcode to appear in the new window. Any assistance on how to generate the barcode in a separate window ...

Utilize the auto-complete feature to narrow down your options when filtering through a list

Check out this plunker that showcases a feature I am aiming to achieve. My goal is to implement an auto-complete list for users to filter the table. Currently, the filtering works smoothly while the user is typing. However, if the user selects an option ...

Tips for introducing a pause between asynchronous line reads when utilizing the readline module in Node.js

In Node.js, I am able to stream a file line-by-line by using the following code snippet: var rd = readline.createInterface({ input: fs.createReadStream('/path/to/file'), output: process.stdout, terminal: false }); rd.on('line', ...

Transform a dynamic list object in a form into JSON using javascript

I have been using a form submission script that converts form inputs to JSON and submits with ajax. It has worked well for simple forms in the past, but I am encountering an issue when trying to use it for lists. Within the form, there is a dynamic list o ...

Incorrect orientation of JSON models in THREE.js

I've been working on a website that incorporates 3D graphics using THREE.js in JavaScript. However, I'm encountering an issue when trying to import a scene where all the objects are facing towards the inside of the planet. You can view the proble ...

Problem with Snowpack's internal module import paths

While working on a project, I am using npx snowpack build --watch instead of the dev command because of a Flask backend. However, I am facing issues with internal imports, specifically modules importing dependencies like Bootstrap importing Popper. The pr ...

Eliminate duplicate objects from arrays of objects by a specific key name

Here are some arrays of objects I am working with: var arr = [ {name: 'john', last: 'smith'}, {name: 'jane', last: 'doe'}, {name: 'johnny', last: 'appleseed'}, {name: 'johnson', ...

Upon initial execution, a Nextjs error occurs: Unable to locate the module 'caniuse-lite/data/features/css-unicode-bidi'

Encountered an error while starting my nextjs project, here's the issue Error - ./node_modules/next/dist/build/webpack/loaders/css-loader/src/index.js??ruleSet[1].rules[2].oneOf[8].use[1]!./node_modules/next/dist/build/webpack/loaders/postcss-loader/s ...

Using NicEdit for uploading to your personal server

I'm having trouble uploading images using the NicEdit WYSIWYG editor on my own server. When I click on the upload image button, it redirects me to another site where I can upload the image: imgur dot com You can find a demo of this here: However, I ...

AngularJs fails to apply style to dynamic content in IE8 when using HTML5

Currently, I am in the process of developing a website with AngularJs and utilizing numerous JS scripts to address compatibility issues with Internet Explorer. I have organized the data in JSON format, and each page is designed to fetch and display differ ...

Storing input values in the state using Typescript by default

Upon launching, my activeField state is initially empty. However, when a user focuses on the field, it gets added to the state. I am encountering a warning in Typescript because when I attempt to update the selectionEnd of that field, it tells me: Property ...

Adding the victory chart in react-native slider causes performance issues, as the slider becomes laggy and there is a delayed reflection

When I use a slider in my application without including a Victory chart, the slider functions smoothly with no issues. However, integrating the slider with the Victory chart causes lag and delays in updating the state value on screen. For more detailed in ...

Inserting data from a form into a MySQL table using NodeJs and Express framework

Extracting data using body-parser typically involves setting up a form with the correct method and action attributes. <form method="post" action="/"> <input type="text" name="user[name]"> <input type="submit" value="Submit"> </for ...

Measuring the performance of NodeJS HTTP servers

My task is to create a nodeJS HTTP server with metrics, but I cannot use any external libraries. The metric for the request will be the response time and route handling will be done using a simple switch statement. const http = require("http"); var metr ...

"How to ensure consistent styling for all buttons, including dynamically created ones, in an application by utilizing the jQuery button widget without the need for repetitive calls to

Hello everyone, I am a newcomer to stack overflow and I have a question to ask. Please excuse any errors in my query. I have searched for an answer but have not been successful in finding one so far. Let's say I have a webpage where I am using the jQ ...

Developing a progress bar with jQuery and Cascading Style Sheets (

Below is the code I'm currently using: <progress id="amount" value="0" max="100"></progress> Here is the JavaScript snippet I have implemented: <script> for (var i = 0; i < 240; i++) { setTimeout(function () { // this repre ...

The AJAX (WCF) request encountered a Bad Request error with status code 400

Struggling to utilize "POST" Methods with WCF, I've found that my service only supports "GET" Methods. The challenge arises when attempting to use "POST" Methods to send Objects: Contract Overview: [ServiceContract] public interface Itest { [Web ...

How can one properly transition an Angular 1 provider to Angular 2?

While there is ample documentation and examples available on how to convert Angular 1 services and factories to Angular 2, the process of converting an ng1 provider to its equivalent in ng2 seems to be a bit more scarce. Here's an example of a provid ...

Button malfunctions when attempting to Append

Currently, I am working on a window-oriented application that operates similar to an operating system using jQuery. The issue I am facing is that when a window is clicked, it appends itself to the parent element, appearing on top of all other windows. Howe ...