Modem, as I know it, has FFFF (65k) ports. Does that mean that it sends signals over different frequencies and my adapter is set by way that it assignes signal of each frequency to a port, or, how does it actually work?

If you are talking about internet ports, then you can just refer to the first sentence of the wiki page: "In computer networking, a port is an application-specific or process-specific software construct". The important words are in bold. Internet ports are purely a matter of software, not hardware. Modems, network adaptors or routers are not physically switching between different "ports" (e.g., frequencies).

When data is sent over a network (and by extension, the internet), it's bundled into "packets" which are analoguous to traditional mail letters, with a to and from address (IP address). The format of the packets is hierarchial (from low-level to high-level). It first has a IP header, followed by a transport-layer header (such as the TCP header), and then the application-specific data follows. As you can see in those links, the IP header contains the IP addresses, and the transport-layer header contains the port number. In other words, these are logical ports, constructed and handled by software, not hardware.

There are 65k ports because both UDP and TCP headers allocate 2 bytes of space for the port number, effectively limiting them to about 65k values.

When it comes to allowing multiple communications through the same media (wire, frequency, etc..), this requires a channel access method or multiplexing. For example, cell phones using CDMA. Wifi mostly uses OFDM. But these are hardware-specific details. Generally, the standards that regulate different kinds of communication mediums (radio, TV, DSL, Wifi, etc.) specify the method by which to modulate and multiplex the signals, and arbitrage methods. This is a whole other ball-game, and is handled at a low-level (hardware / firmware) that users or software do not have access to.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of 1.21 million developers, IT pros, digital marketers, and technology enthusiasts learning and sharing knowledge.