How to get server information from URL? [closed] - rtsp

Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 7 years ago.
Improve this question
mms://58.231.196.73/busanmbc-fm-onair-20120228 is an audio streaming URL. When I input this to a web browser, it plays radio.
The default port of MMS is 1755 and that of RTSP is 554. When I input mms://58.231.196.73:1755/busanmbc-fm-onair-20120228 to a web browser, it doesn't work and in case of mms://58.231.196.73:554/busanmbc-fm-onair-20120228 it works.
I wonder how a web browser recognizes the RTSP default port as the port of that URL even though it is MMS of which default port is 1755.

Many well-known protocols have default ports, see Wikipedia. In your case the URL scheme contains the required information to determine the protocol and thus port number.
Update: I can promise you, that there is no port information hidden in the URL you provided, other than the scheme.
From RFC 3986 we know that there is either an explicitly named port:
The port subcomponent of authority is designated by an optional port
number in decimal following the host and delimited from it by a
single colon (":") character.
Or a default port derived from the scheme:
A scheme may define a default port. For example, the "http" scheme
defines a default port of "80"

Related

port scanning a home network using nmap but can't understand how was nmap able to find open ports ,when more than 1 devices were connected [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
This question does not appear to be about a specific programming problem, a software algorithm, or software tools primarily used by programmers. If you believe the question would be on-topic on another Stack Exchange site, you can leave a comment to explain where the question may be able to be answered.
Closed 1 year ago.
Improve this question
I saw a video in which a person scanned a public IP(it was his SOHO network) using nmap. It showed all the open ports and other info but I don't understand how can nmap scan ports and tell which are open when there are multiple devices on that network. Is it that nmap scans all the devices on that network using that public IP and then shows a collective result or is it something else?
Link for that video
at 7:43
When NMAP scans an IP, it, in theory only scans the device who is running on that IP.
But there is a catch, if the IP that the NMAP scans is a device with port forwarding, it will forward the scan for that port to the device that the port forwarding is directed at.
To give you an example, I will define few stuff
You have 3 devices, 1 router that has a public IP, 2 servers that are
behind the router.
We will be scanning 4 ports, 10, 20, 30, 40
Port 10 is open on the router itself, its used for public communication
Port 20 is not opened on the router and its not being port forwarded
Port 30 is being port forwarded to Server 1, who has that port open
Port 40 is being port forwarded to Server 2, but that server doesn't have that port open
In the results on NMAP, you will get the following result.
Ports 10 and 30 will show up as open, while ports 20, 40, will show up closed or maybe filtered
So while we only scanned the one public IP and one device on that IP, we can see the device that is behind the router.
But that is only possible because when we try to connect to a port on a router, the router is saying:
"Okay, this connection is trying to go to port 30, I have a configuration here that says that port 30 should go to Server 1 on that port, I will redirect the traffic to that server and then when I get the response from the server, I will redirect to the device that made the request"

Reverse proxy in home network [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
This question does not appear to be about a specific programming problem, a software algorithm, or software tools primarily used by programmers. If you believe the question would be on-topic on another Stack Exchange site, you can leave a comment to explain where the question may be able to be answered.
Closed 5 years ago.
Improve this question
I want to set up a reverse proxy in my home network. The idea is to route traffic to correct port number based on subdomain in the request URL.
Example: I'm setting two subdomain A records on my domain: nas.mydomain.tld and wiki.mydomain.tld. Both A records point to my dedicated IP address at home. I want a reverse proxy that routes:
nas.mydomain.tld => 192.168.2.2:5001
wiki.mydomain.tld => 192.168.2.2:8090
Can this be done in e.g. my ASUS RT-AC55U router, or can I route all traffic to my file server and have a reverse proxy there route the traffic to correct IP addresses and ports?
From what I found out, the problem lies in that the functionality I want (multiple types of content retrieved from the same IP and port) cannot be done without some kind of middle-man; a reverse proxy server that fetches the content based on the URL and relays it.
Asus router: My ASUS RT-AC55U router doesn't have a reverse proxy server, at least not with standard firmware. I haven't researched if some unofficial kind of firmware contains a reverse proxy server for doing this. So the only option is to use a NAT record to route port 80 to a specific port. The downside is that it only supports one web service on the IP address.
Web hotel: Creating a rewrite in a .htaccess file on the web hotel of a registrar, but it will only redirect and not rewrite/mask URL. Otherwise, the registrar would need a reverse-proxy server to fetch the content from the web services to relay it. I don't think my current registrar supports this, and I can understand if they don't want to do it from a security standpoint.
Apache reverse proxy server: Apache supports this using the mod_proxy module and an entry in the conf file. More info on it here: https://httpd.apache.org/docs/2.4/vhosts/examples.html#proxy
CCProxy: CCProxy is definitely the easiest solution that I've found so far. It's a simple GUI application where you can add URL's, host names/IP addresses and ports, and the application takes care of the rest. Also has a very nice graphical representation of usage/bandwidth, and a graphical log of ongoing sessions. More info here: http://www.youngzsoft.net/ccproxy/

What exactly is a 'port', and how is it related to the internet? [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
This question does not appear to be about a specific programming problem, a software algorithm, or software tools primarily used by programmers. If you believe the question would be on-topic on another Stack Exchange site, you can leave a comment to explain where the question may be able to be answered.
Closed 10 months ago.
Improve this question
I've searched extensively on this topic, yet I'm still confused about what exactly a 'port' is.
I know what it is 'conceptually', and I know that there are many different ports, and that some numbers, like 80 are reserved for certain uses, and I know that by typing in the 'netstat' commands in the CMD I can check if they are in use.
But I still don't understand what a port is. Does it 'physically' exist on my computer? Because all I see is one Ethernet connection line that I plug in, not some 6000 different ports that do different things.
And I don't really get how it's got to do with my internet browser. When I click on my 'Chrome.exe.' icon, does that 'open' the 80 -number port?
To reach a service on any networked computer you need to know 3 parameters. Some of them you provide explicitly and some of them are deduced by operating system implicitly. The three parameters are IP Address, Protocol, Port number. So any running service can be uniquely described by a combination of these three numbers.
Imagine, that we did not use port numbers. That would mean that on each computer we could have only one service using any of the protocols. So a web server could only serve HTTP protocol, mail server could only provide SMTP services and so on.
Usage of ports allows us to multiplex services on same computer. A port number is nothing more than a number, indicating what service should get a data packet. So we can have HTTP server, SMTP server and SSH server all running on a same computer and all using same protocol - namely TCP.
Also, these ports have nothing to do with a physical ports you see on your computer. Once again - they are just a number, allowing to distinguish which service (i.e. program) should receive which packet.
For example when I enter www.stackoverflow.com in my web-browsers address bar, my OS sends a HTTP request to {IP:104.16.34.249, Proto: TCP, Port: 80}. How does it know these numbers? IP address is resolved from the host name using the DNS protocol. Web browser is running HTTP protocol, which is using TCP. Port 80 is default port for HTTP. Behind the scenes, each packet will have destination address IP set to the above value and TCP payload will have destination port set to 80. On the SO computer, there will be a web-server running, which is listening for data received on port 80 and replies to my packet.
A port number is a 16-bit unsigned integer, thus ranging from 0 to 65535. For TCP, port number 0 is reserved and cannot be used, while for UDP, the source port is optional and a value of zero means no port.
A process associates its input or output channels via an Internet socket, which is a type of file descriptor, associated with a transport protocol, an IP address, and a port number. This is known as binding.
A socket is used by a process to send and receive data via the network. The operating system's networking software has the task of transmitting outgoing data from all application ports onto the network, and forwarding arriving network packets to processes by matching the packet's IP address and port number to a socket. For TCP, only one process may bind to a specific IP address and port combination.
Common application failures, sometimes called port conflicts, occur when multiple programs attempt to use the same port number on the same IP address with the same protocol.
https://en.wikipedia.org/wiki/Port_(computer_networking)
For short, ports are just logical numbers (not exists physically) related to services (or server software) whats are running above the operating system (ftp server, web server etc). When there is an incoming connection (or any traffic) addressed to a specific port, the OS can forward the traffic to the proper service for handling.
By default browsers are addressing the given site with port number 80 so
http://www.randomsite.com and http://www.randomsite.com:80 are identical.
If you request something from the internet then it has to send data to your request but the data is been sent in the form of data packets and the server needs some address to where it has to send the data packets and here comes the role of IP address.
An IP address identifies a machine in an IP network and is used to determine the destination of a data packet.
So the data will reach to your system or computer but still it doesn't know which application it has to send the data so here we use port number to identify the applications.
Port numbers identify a particular application or service on a system.

Can we set the port number for listening in some automatic way rather than hardcoding it? [closed]

Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 8 years ago.
Improve this question
In typical example client server programs found on the net, we can see the following hardcoded way of specifying the port number which is actually the process id of the process which will be used to handle the incomming messages.
Can we set the port number for listening in some automatic way rather than hardcoding it?
I mean how are we always supposed to the know the port number beforehand?
serverAddr.sin_family = AF_INET;
/* Set port number, using htons function to use proper byte order
Port number is the process id of the process which will be used to
handle the incomming messages.
*/
serverAddr.sin_port = htons (7891);
/* Set IP address to localhost */
serverAddr.sin_addr.s_addr = inet_addr ("127.0.0.1");
/* Set all bits of the padding field to 0 */
memset(serverAddr.sin_zero, '\0', sizeof serverAddr.sin_zero);
/*---- Bind the address struct to the socket ----*/
bind(welcomeSocket, (struct sockaddr *) &serverAddr, sizeof(serverAddr));
If the port number is dynamically identified during the execution process of the client, then transfer it to server via another interprocess communication. e.g.
I would suggest to perform following :
Establish initial connection with defined and hardcoded port number()
Transfer the port/process id of the client to server
Close the initial connection
Establish the wanted connection
In a typical server application, the port is often hardcoded, or at least a default is hardcoded because port numbers are normally "well-known". It's how you tell the server what application layer protocol (and finally, what socket) you're trying to talk to. That's (normally) the correct thing to do.
For example, you know that a web server (HTTP) usually runs on port 80 and HTTP over TLS runs on 443. There is a list of assigned numbers for that. This port is what the client normally expects, and this is the port the client will normally, by default, try to talk to -- unless you do a special dance. By default, this will "just work".
Of course it is entirely possible to run the same service on a different port (say, 88 or 8080, to stick with the HTTP example), but then the client has to know this, and unless the client has been redirected in some way, the user will have to manually enter the port number. This is tedious because things no longer "just work".
It gets particularly annoying in some cases where deliberately wrong port numbers are used for "security" (for example DSM's new security advisor raises a warning if you run SSH on its standard port... which is a real "WTF?!" because a different port offers zero added security but makes logging in legitimately a nuisance, you need to remember adding the port number every time).
Still, because sometimes people want to (or need to, for example if a given port is blocked on the gateway, or if a port is already taken by another service) run a service on a non-standard port. Therefore, it is usually possible to specify an alternate port either one the command line (via argc/argv) or in a config file. Thus, if you just run server, you might have it listen on 1234, which is the default that you hardcoded, but if you run server -p 7890 it will listen on port 7890 instead.

What happens when I click google.com on my browser [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 9 years ago.
Improve this question
What happens exactly when I hit the link Google.com on my browser. Can anybody please explain it technically how all this work.
Thanks
Reference Taken from
Hyper Text Transfer Protocol (HTTP) is a protocol used for transferring web pages (like the one you're reading right now). A protocol is really nothing but a standard way of doing things. If you were to meet the President of the United States, or the king of a country, there would be specific procedures that you'd have to follow. You couldn't just walk up and say "hey dude". There would be a specific way to walk, to talk, a standard greeting, and a standard way to end the conversation. Protocols in the TCP/IP stack serve the same purpose.
The TCP/IP stack has four layers: Application, Transport, Internet, and Network. At each layer there are different protocols that are used to standardize the flow of information, and each one is a computer program (running on your computer) that's used to format the information into a packet as it's moving down the TCP/IP stack. A packet is a combination of the Application Layer data, the Transport Layer header (TCP or UDP), and the IP layer header (the Network Layer takes the packet and turns it into a frame).
The Application Layer
...consists of all applications that use the network to transfer data. It does not care about how the data gets between two points and it knows very little about the status of the network. Applications pass data to the next layer in the TCP/IP stack and then continue to perform other functions until a reply is received. The Application Layer uses host names (like www.dalantech.com) for addressing. Examples of application layer protocols: Hyper Text Transfer Protocol (HTTP -web browsing), Simple Mail Transfer Protocol (SMTP -electronic mail), Domain Name Services (DNS -resolving a host name to an IP address), to name just a few.
The main purpose of the Application Layer is to provide a common command language and syntax between applications that are running on different operating systems -kind of like an interpreter. The data that is sent by an application that uses the network is formatted to conform to one of several set standards. The receiving computer can understand the data that is being sent even if it is running a different operating system than the sender due to the standards that all network applications conform to.
The Transport Layer
...is responsible for assigning source and destination port numbers to applications. Port numbers are used by the Transport Layer for addressing and they range from 1 to 65,535. Port numbers from 0 to 1023 are called "well known ports". The numbers below 256 are reserved for public (standard) services that run at the Application Layer. Here are a few: 25 for SMTP, 53 for DNS (udp for domain resolution and tcp for zone transfers) , and 80 for HTTP. The port numbers from 256 to 1023 are assigned by the IANA to companies for the applications that they sell.
Port numbers from 1024 to 65,535 are used for client side applications -the web browser you are using to read this page, for example. Windows will only assign port numbers up to 5000 -more than enough port numbers for a Windows based PC. Each application has a unique port number assigned to it by the transport layer so that as data is received by the Transport Layer it knows which application to give the data to. An example is when you have more than one browser window running. Each window is a separate instance of the program that you use to surf the web, and each one has a different port number assigned to it so you can go to www.dalantech.com in one browser window and this site does not load into another browser window. Applications like FireFox that use tabbed windows simply have a unique port number assigned to each tab
The Internet Layer
...is the "glue" that holds networking together. It permits the sending, receiving, and routing of data.
The Network Layer
...consists of your Network Interface Card (NIC) and the cable connected to it. It is the physical medium that is used to transmit and receive data. The Network Layer uses Media Access Control (MAC) addresses, discussed earlier, for addressing. The MAC address is fixed at the time an interface was manufactured and cannot be changed. There are a few exceptions, like DSL routers that allow you to clone the MAC address of the NIC in your PC.
For more info:
Protocols
TCP/IP

Resources