Reputation: 391
I have a desktop application that is running on a particular port in a Windows machine. I am now developing a chrome extension that interacts with the desktop application. I would like to know the port number on which the desktop application is running.
Is there any way how I can identify the port number of an application using javascript ? Any pointers will be really helpful.
Upvotes: 1
Views: 1497
Reputation: 155692
You can use chrome.sockets.tcp
to connect to a known endpoint.
You have to request the specific endpoint in the manifest in order to have permission to access it.
If the manifest allows it you could try lots of ports at that endpoint until you found one that responded with your service, but that would be sloooooooooow and incredibly bug prone.
Instead choose a specific port (or make it configurable) and just connect directly.
Upvotes: 1