0

I am sure there is a better way to describe the challenge I have, but hopefully this will be clear enough.

I have a server running on a random host + port within the local area network, I would like to know that hostname and port, or at least the random port, so that my (web) client can connect to the correct URL.

This specific server happens to run and respond to M-SEARCH (SSDP) queries, but I do not think you can query that from a webpage/javascript.

I don't mind using a common (cloud) server to help with the process.

edit: Come to think about it, I don't know what I was thinking about UPNP etc, my 'client' only has a browser and a url to provide, so I cannot run evena javascript before he hits my server:port. perhaps the solution has to be with some kind of well known address on the cloud or a well known port on the host.

1 Answers1

0

You can use the netstat command to find the open ports on a server (windows or linux)

example on linux to find a java app server:

netstat -anp | grep java 

Output - it was listening on port 8080:

tcp        0      0 10.121.235.200:8080    0.0.0.0:*               LISTEN      7051/java

And as a side note, you may find this useful, if you have an idea it should be a certain port, you can check if there's a process running that is listening to it by using lsof:

lsof -i :portNumber

Example:

lsof -i :80
Twosingleton
  • 71
  • 1
  • 7
  • Thanks, but this is helpful when I am running on the same host, my question is about when my browser is on another machine. – Uri Maimon - Nominal Jun 05 '13 at 06:02
  • I am not sure I fuly understand what you are trying to say. But this is what you shoulf try - login to your server, find the right ports using the command above, open the browser and go to the right IP and port by inputting in the address bar as follows: -> IP:port, ex: 10.10.100.200:8080 – Twosingleton Jun 06 '13 at 02:26