Next: Devices
Up: Sockets
Previous: An Example Using Local
Contents
- UNIX-domain sockets can be used only for communication between two processes
on the same computer.
- Internet-domain sockets, on the other hand, may be used to connect processes on different machines connected by a network.
- Sockets connecting processes through the Internet use the Internet namespace represented by PF_INET. The most common protocols are TCP/IP.
- Internet socket addresses contain two parts: a machine and a port number.This information is stored in a struct sockaddr_in variable.
- Fig. 6.12 illustrates the use of Internet-domain sockets. The http://siber.cankaya.edu.tr/SystemsProgramming/cfiles/socket-inet.cprogram obtains the home page from the Web server whose hostname is specified on the command line.
Figure 6.12:
Read from a WWW Server.
|
$ ./socket-inet siber.cankaya.edu.tr
Cem Ozdogan
2007-05-16