计算机专业毕业设计外文翻译--Beej 对网络编程的指导
《计算机专业毕业设计外文翻译--Beej 对网络编程的指导》由会员分享,可在线阅读,更多相关《计算机专业毕业设计外文翻译--Beej 对网络编程的指导(11页珍藏版)》请在毕设资料网上搜索。
1、Beejs Guide to Network Programming 作者: Beej source:http:/ 1. What is a socket? You hear talk of sockets all the time, and perhaps you are wondering just what they are exactly. Well, theyre this: a way to speak to other programs using standard Unix file descriptors.What? Okyou may have heard some Uni
2、x hacker state, Jeez, everything in Unix is a file! What that person may have been talking about is the fact that when Unix programs do any sort of I/O, they do it by reading or writing to a file descriptor. A file descriptor is simply an integer associated with an open file. But (and heres the catc
3、h), that file can be a network connection, a FIFO, a pipe, a terminal, a real on-the-disk file, or just about anything else. Everything in Unix is a file! So when you want to communicate with another program over the Internet youre goanna do it through a file descriptor, youd better believe it. Wher
4、e do I get this file descriptor for network communication, Mr. Smarty-Pants? is probably the last question on your mind right now, but Im going to answer it anyway: You make a call to the socket () system routine. It returns the socket descriptor, and you communicate through it using the specialized
5、 send () and recv () (man send4, man recv5) socket calls. But, hey! you might be exclaiming right about now. If its a file descriptor, why in the name of Neptune cant I just use the normal read () and write () calls to communicate through the socket? The short answer is, You can! The longer answer i
6、s, You can, but send () and recv () offer much greater control over your data transmission. What next? How about this: there are all kinds of sockets. There are DARPA Internet addresses (Internet Sockets),path names on a local node (Unix Sockets), CCITT X.25 addresses (X.25 Sockets that you can safe
7、ly ignore), and probably many others depending on which Unix flavor you run. This document deals only with the first: Internet Sockets. 2.1. Two Types of Internet Sockets Whats this? There are two types of Internet sockets? Yes. Well, no. Im lying. There are more, but I didnt want to scare you. Im o
8、nly going to talk about two types here. Except for this sentence, where Im going to tell you that Raw Sockets are also very powerful and you should look them up. All right, already. What are the two types? One is Stream Sockets; the other is Datagram Sockets, which may hereafter be referred to as SO
9、CK_STREAM and SOCK_DGRAM, respectively. Datagram sockets are sometimes called connectionless sockets. (Though they can be connect ()d if you really want.) Stream sockets are reliable two-way connected communication streams. If you output two items into the socket in the order 1, 2, they will arrive
- 配套讲稿:
如PPT文件的首页显示word图标,表示该PPT已包含配套word讲稿。双击word图标可打开word文档。
- 特殊限制:
部分文档作品中设计图片,仅作为作品整体效果示例展示,禁止商用。设计者仅对作品中独创性部分享有著作权。
- 关 键 词:
- 计算机专业 毕业设计 外文 翻译 beej 对于 网络 编程 指导 指点 指示
