Sophie

Sophie

distrib > Mandriva > 2010.0 > i586 > media > contrib-release > by-pkgid > bd5c3d824c3db63ffd9226c15941e6ad > files > 1511

mozart-1.4.0-1mdv2010.0.i586.rpm

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD><TITLE>5.1 Sockets in a Nutshell</TITLE><LINK href="ozdoc.css" rel="stylesheet" type="text/css"></HEAD><BODY><TABLE align="center" border="0" cellpadding="6" cellspacing="6" class="nav"><TR bgcolor="#DDDDDD"><TD><A href="node10.html">- Up -</A></TD><TD><A href="node12.html#section.sockets.stream">Next &gt;&gt;</A></TD></TR></TABLE><DIV id="section.sockets.nutshell"><H2><A name="section.sockets.nutshell">5.1 Sockets in a Nutshell</A></H2><P>A socket is a data structure which can be used for communication between operating system processes on possibly different computers connected by a network.</P><P></P><DIV id="section.domain"><H3><A name="section.domain">5.1.1 Domain</A></H3><A name="label72"></A><P>Unix based operating systems offers two domains for sockets: The <A name="label73"></A><EM>Internet</EM> <A name="label74"></A> domain and the <A name="label75"></A><EM>Unix</EM><A name="label76"></A> domain. The first can be used for communication all over the world, whereas the latter is only applicable within one Unix system. Other systems might offer only sockets for the Internet domain. Mozart supports sockets for the Internet domain. </P></DIV><DIV id="section.type"><H3><A name="section.type">5.1.2 Type</A></H3><P><A name="label77"></A> </P><P>Sockets we are going to describe here are either of type <A name="label78"></A><EM>stream</EM> <A name="label79"></A> or of type <A name="label80"></A><EM>datagram</EM> <A name="label81"></A>. There are more than these types of sockets, which are used by the operating system internally for implementing stream and datagram sockets themselves. See for instance <CODE>socket(2)</CODE>. </P><P>A <A name="label82"></A><EM>stream</EM> socket is connection-oriented: Two processes establish a one-to-one connection in using a socket. After the connection has been established a stream socket has the following features: </P><OL type="1"><LI><P>Stream oriented: Character codes are incrementally sent and received.</P></LI><LI><P>Duplex: Both processes have sending and receiving access to the stream. The data passed are <A name="label83"></A><EM>bytes</EM>, i.&nbsp;e. small integers between 0 and 255.</P></LI><LI><P>Reliability: No data will be lost in most cases. </P></LI><LI><P>Sequencing: The order of data sent will not be changed.</P></LI></OL><P> </P><P>A <A name="label84"></A><EM>datagram</EM> has only the feature of being duplex: It provides no reliability and no sequencing (messages may arrive in any order). It supports sending and receiving data packets of a (usually) small size. </P><P></P></DIV><H3><A name="label85">5.1.3 Protocol</A></H3><A name="label86"></A><P>The protocol of a socket gives services used for performing communication on it. For example, the usual protocols for the Internet domain are TCP<A name="label87"></A> (Internet Transmission Control Protocol) for stream sockets and UDP<A name="label88"></A> (Internet User Datagram Protocol) for datagram sockets. </P></DIV><TABLE align="center" border="0" cellpadding="6" cellspacing="6" class="nav"><TR bgcolor="#DDDDDD"><TD><A href="node10.html">- Up -</A></TD><TD><A href="node12.html#section.sockets.stream">Next &gt;&gt;</A></TD></TR></TABLE><HR><ADDRESS><A href="http://www.ps.uni-sb.de/~schulte/">Christian&nbsp;Schulte</A><BR><SPAN class="version">Version 1.4.0 (20090610)</SPAN></ADDRESS></BODY></HTML>