Page 1 of 1

software and hardware ports

Posted: Thu Apr 19, 2012 4:02 am
by skandalOS
Hello everyone!

I've got a question which maybe not fit to this forum but I never found a forum as this and therefore
I've decided to ask.

My question is about Ports.

I do not know so such about networking there to apologize me if that was a silly question.

Firstly hardware ports are used to communicate to peripherical devices like printer or mouse and so on.
So is that true when communicate with a printer you are responding an adress on your memory, which we call
port. So the printer gets a signal that there is something to printout.
Where do I get the port number of the printer?
How does I signal to printer or is the printer always listening?
And where does the printer gets data should there be something like shared object?

Now I have questions about software ports.
If you want to receive data of a webpage you are connected over a TCP/UDP or whatever to the server.
You send your IP-address and other relevant information about you to receive the data you want.

I want for example to receive data from (216.239.51.99) and binding to port 80.
So what should I give in the parcel to get data on my PC, I've to include a port number like the protocol needs.
Can I give any virtual port of my computer. How do I get a free port from my PC?

Please help me I'm so confused :-(


thanks

Re: software and hardware ports

Posted: Thu Apr 19, 2012 5:02 am
by Solar
"Port" is a name used for wildly different things.

The physical connector, e.g. for USB, serial, or parallel connections, is called "port" ("USB port", "serial port").

In network programming a "port" refers to a number, part of the TCP / UDP protocol, and usually equivalent to a specific higher-level protocol ("port 80 (HTTP)", "port 22 (SSH)").

In OS kernel development, there are "I/O ports", used for communicating between the CPU and other chips in the system (like port 0x378, 0x400).

None of these have anything to do with each other.

skandalOS wrote:Where do I get the port number of the printer?
No such thing.
How does I signal to printer or is the printer always listening?
The printer is always "listening".
And where does the printer gets data should there be something like shared object?
A printer does not get sent "shared objects", or even "documents". There is a whole protocol involved, very much depending on the printer (e.g., Postscript, PCL, ESC/P, ...), and each requires a driver to translate whatever you want to get printed into something the printer actually understands. Unless you are writing a printer driver, this subject should be of little interest.
I want for example to receive data from (216.239.51.99) and binding to port 80.
So what should I give in the parcel to get data on my PC, I've to include a port number like the protocol needs.
Can I give any virtual port of my computer. How do I get a free port from my PC?
See a tutorial about network programming in your language of choice.

As I wrote above, all these things are completely disjunct, they have nothing in common except that they are about communication in the widest sense. For each of these subjects, books and tutorials exist, and there is no way one could cover them alltogether in a single forum post.

Re: software and hardware ports

Posted: Thu Apr 19, 2012 5:29 am
by skandalOS
thank you very much