免费注册 查看新帖 |

Chinaunix

  平台 论坛 博客 文库
最近访问板块 发新帖
查看: 793 | 回复: 0
打印 上一主题 下一主题

Berkeley sockets [复制链接]

论坛徽章:
0
跳转到指定楼层
1 [收藏(0)] [报告]
发表于 2007-11-14 01:07 |只看该作者 |倒序浏览
Before studying the Unix/Linux network programming(UNP), it is of importance to learn some background knowledge about UNP, such as the concept of socket, Unix standards, etc.
Berkeley socket, also called BSD sockets, is a generalized networking capability first introduced in 4.1cBSD and subsequently refined into their current form with 4.2BSD. The sockets feature is available with most current UNIX system releases. (Transport Layer Interface (TLI) is the System V alternative). Sockets allow communication between two different processes on the same or different machines. Internet protocols are used by default for communication between machines; other protocols such as DECnet can be used if they are available.
The following are some general information about Berkeley Sockets
  • Developed in the early 1980s at the University of California at Berkeley. There are no longer any major alternatives. Other major alternative was TLI (Transport Layer Interface).   There are communications tools that are built on tool of Berkeley sockets. (E.g. RPC )
  • It is an API.
  • Its implementation is usually requires kernel code.
  • It is the defacto standard for communications programming.
  • There are higher level tools for programs that span more than one machine. RPC, DCOM and windows remoting are examples.
  • Used for point-to-point communications between computers through an inter-systems pipe. Namely can use the UNIX read, write, close, select, etc. system calls.
  • Supports broadcast. This is where the same message may be delivered to multiple systems on a network without additional overhead.
  • Available on every UNIX system that I know of and somewhat available in WIN32.   
  • Build for client/server development. That is having one system provide a service to other systems. To a programmer a socket looks and behaves much like a low level file descriptor. This is because commands such as read() and write() work with sockets in the same way they do with files and pipes. The differences between sockets and normal file descriptors occurs in the creation of a socket and through a variety of special operations to control a socket. These operations are different between sockets and normal file descriptors because of the additional complexity in establishing network connections when compared with normal disk access.
    Berkeley sockets support two types of communications. These sit on top of the TCP Internet datagrams.
    TCP - connection oriented, stream, reliable.
    UDP - connectionless, record oriented, unreliable.
    Some useful links:
    1.
    An overview on Berkeley Sockets
    :
        http://phobos.ramapo.edu/~vmiller/AdvancedUnix/berkeley_socket.htm
    2.
    Something about Berkeley sockets, including a group of useful examples
    :
       http://www.ecst.csuchico.edu/~chafey/prog/sockets/sinfo1.html


    本文来自ChinaUnix博客,如果查看原文请点:http://blog.chinaunix.net/u1/53857/showart_421724.html
  • 您需要登录后才可以回帖 登录 | 注册

    本版积分规则 发表回复

      

    北京盛拓优讯信息技术有限公司. 版权所有 京ICP备16024965号-6 北京市公安局海淀分局网监中心备案编号:11010802020122 niuxiaotong@pcpop.com 17352615567
    未成年举报专区
    中国互联网协会会员  联系我们:huangweiwei@itpub.net
    感谢所有关心和支持过ChinaUnix的朋友们 转载本站内容请注明原作者名及出处

    清除 Cookies - ChinaUnix - Archiver - WAP - TOP