To obtain a service we do not request a file handle but a port A port is a

To obtain a service we do not request a file handle

This preview shows page 75 - 77 out of 102 pages.

To obtain a service, we do not request a file handle but a port . A port is a software concept - it should not be confused with the hardware connector which couples your machine to the network (which is also called a port on some systems). It is a number which an operating system uses to figure out which service a client wants. We say that a particular service lives at port xxx . Here is some important terminology. Well-known ports. Every computer, all over the world has to agree on the port numbers for different services. A well-known port is a port number () which is reserved for a well-known service like ftp or telnet . It has been registered in a world-wide register. RPC program numbers. Historically, we distinguish between services and RPC, although the effect of the two is the same. The system of calling RPC services is different to normal services - it uses program numbers first, and works out port numbers for itself. 6.4 UNIX client-server implementation It is useful to describe how UNIX deals with services, since this is the model which has been adapted for other systems. 6.4.1 Socket based communication To send data to a server using sockets, we need to know the port number at which the server lives. Port numbers are listed in the file /etc/services , which looks like this. # # Network services, Internet style # This file is never consulted when the NIS are running # tcpmux 1/tcp # rfc-1078 echo 7/tcp echo 7/udp
Image of page 75
... ftp 21/tcp telnet 23/tcp smtp 25/tcp mail time 37/tcp timserver time 37/udp timserver name 42/udp nameserver whois 43/tcp nicname # usually to sri-nic domain 53/udp domain 53/tcp hostnames 101/tcp hostname # usually to sri-nic sunrpc 111/udp sunrpc 111/tcp ... login 513/tcp shell 514/tcp cmd # no passwords used printer 515/tcp spooler # line printer spooler courier 530/tcp rpc # experimental uucp 540/tcp uucpd # uucp daemon biff 512/udp comsat who 513/udp whod syslog 514/udp talk 517/udp route 520/udp router routed ingreslock 1524/tcp bootpc 68/udp # boot program client bootp 67/udp bootps # boot program server The file maps named services into port numbers and protocol type. The protocol type is also an agreed standard which is defined in the file /etc/protocols , which looks like this: # # Internet (IP) protocols # This file is never consulted when the NIS are running # ip 0 IP # internet protocol, pseudo protocol number icmp 1 ICMP # internet control message protocol igmp 2 IGMP # internet group multicast protocol ggp 3 GGP # gateway-gateway protocol tcp 6 TCP # transmission control protocol pup 12 PUP # PARC universal packet protocol udp 17 UDP # user datagram protocol hmp 20 HMP # host monitoring protocol xns-idp 22 XNS-IDP # Xerox NS IDP rdp 27 RDP # "reliable datagram" protocol In order to open a socket, we must know the name of the host on which the server lives. If we don't know this information in advance, we can send a broadcast request to all hosts, hoping that one of them will reply with their correct address (see next chapter).
Image of page 76
Image of page 77

You've reached the end of your free preview.

Want to read all 102 pages?

  • One '20

What students are saying

  • Left Quote Icon

    As a current student on this bumpy collegiate pathway, I stumbled upon Course Hero, where I can find study resources for nearly all my courses, get online help from tutors 24/7, and even share my old projects, papers, and lecture notes with other students.

    Student Picture

    Kiran Temple University Fox School of Business ‘17, Course Hero Intern

  • Left Quote Icon

    I cannot even describe how much Course Hero helped me this summer. It’s truly become something I can always rely on and help me. In the end, I was not only able to survive summer classes, but I was able to thrive thanks to Course Hero.

    Student Picture

    Dana University of Pennsylvania ‘17, Course Hero Intern

  • Left Quote Icon

    The ability to access any university’s resources through Course Hero proved invaluable in my case. I was behind on Tulane coursework and actually used UCLA’s materials to help me move forward and get everything together on time.

    Student Picture

    Jill Tulane University ‘16, Course Hero Intern

Stuck? We have tutors online 24/7 who can help you get unstuck.
A+ icon
Ask Expert Tutors You can ask You can ask ( soon) You can ask (will expire )
Answers in as fast as 15 minutes
A+ icon
Ask Expert Tutors