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.