《计算机毕业设计(论文)外文翻译.doc》由会员分享,可在线阅读,更多相关《计算机毕业设计(论文)外文翻译.doc(14页珍藏版)》请在三一办公上搜索。
1、毕业设计(论文)外文文献翻译(2008届)译文一: Introduction to TCP/IP Introduction译文二: Client Server Programming with Winsock学生姓名 学 号 0403040211 系 别 信息与电子系 专业班级 计算机科学与技术0402 指导教师 完成日期 2007年11月26日 Introduction to TCP/IP IntroductionAuthor Catalyst DevelopmentCatalyst Development is a recognized leader in Internet compone
2、nt software whose award-winning products are used by thousands of corporate, government and independent developers around the world.IntroductionWith the acceptance of TCP/IP as a standard platform-independent network protocol, and the explosive growth of the Internet, the Windows Sockets API (applic
3、ation program interface) has emerged as the standard for network programming in the Windows environment. This document will introduce the basic concepts behind Windows Sockets programming and get you started with your first application created with SocketWrench.SocketWrench is part of a package deve
4、loped by Catalyst called the SocketTools Visual Edition. SocketTools includes components and libraries for many of the popular Internet application protocols, such as FTP, POP3, SMTP and HTTP. For more information about the complete SocketTools package, visit the Catalyst website at . It is assumed
5、that the reader is familiar with Visual Basic and has installed the SocketWrench control.If youre already familiar with sockets programming, feel free to skip this section.There are two general approaches that you can take when creating a program that uses Windows Sockets. One is to code directly ag
6、ainst the API. The other is to use a component which provides a higher-level interface to the library by setting properties and responding to events. This can provide a more natural programming interface, and it allows you to avoid much of the error-prone drudgery commonly associated with sockets pr
7、ogramming. By including the control in a project, setting some properties and responding to events, you can quickly and easily write an Internet-enabled application. SocketWrench provides a comprehensive interface to the Windows Sockets library and will be used to build a simple client-server applic
8、ation in the next section of this document. Before we get started with the control, however, well cover the basic terminology and concepts behind sockets programming in general.Transmission Control Protocol (TCP)When two computers wish to exchange information over a network, there are several compon
9、ents that must be in place before the data can actually be sent and received. Of course, the physical hardware must exist, which is typically either a network interface card (NIC) or a serial communications port for dial-up networking connections. Beyond this physical connection, however, computers
10、also need to use a protocol which defines the parameters of the communication between them. In short, a protocol defines the rules of the road that each computer must follow so that all of the systems in the network can exchange data. One of the most popular protocols in use today is TCP/IP, which s
11、tands for Transmission Control Protocol/Internet Protocol.By convention, TCP/IP is used to refer to a suite of protocols, all based on the Internet Protocol (IP). Unlike a single local network, where every system is directly connected to each other, an internet is a collection of networks, combined
12、into a single, virtual network. The Internet Protocol provides the means by which any system on any network can communicate with another as easily as if they were on the same physical network. Each system, commonly referred to as a host, is assigned a unique 32-bit number which can be used to identi
13、fy it over the network. Typically, this address is broken into four 8-bit numbers separated by periods. This is called dot-notation, and looks something like 192.43.19.64. Some parts of the address are used to identify the network that the system is connected to, and the remainder identifies the sys
14、tem itself. Without going into the minutia of the Internet addressing scheme, just be aware that there are three classes of addresses, referred to as A, B and C. The rule of thumb is that class A addresses are assigned to very large networks, class B addresses are assigned to medium sized networks,
15、and class C addresses are assigned to smaller networks (networks with less than approximately 250 hosts).When a system sends data over the network using the Internet Protocol, it is sent in discrete units called datagrams, also commonly referred to as packets. A datagram consists of a header followe
16、d by application-defined data. The header contains the addressing information which is used to deliver the datagram to its destination, much like an envelope is used to address and contain postal mail. And like postal mail, there is no guarantee that a datagram will actually arrive at its destinatio
17、n. In fact, datagrams may be lost, duplicated or delivered out of order during their travels over the network. Needless to say, this kind of unreliability can cause a lot of problems for software developers. Whats really needed is a reliable, straight-forward way to exchange data without having to w
18、orry about lost packets or jumbled data.To fill this need, the Transmission Control Protocol (TCP) was developed. Built on top of IP, TCP offers a reliable, full-duplex byte stream which may be read and written to in a fashion similar to reading and writing a file. The advantages to this are obvious
19、: the application programmer doesnt need to write code to handle dropped or out-of-order datagrams, and instead can focus on the application itself. And because the data is presented as a stream of bytes, existing code can be easily adopted and modified to use TCP.TCP is known as a connection-orient
20、ed protocol. In other words, before two programs can begin to exchange data they must establish a connection with each other. This is done with a three-way handshake in which both sides exchange packets and establish the initial packet sequence numbers (the sequence number is important because, as m
21、entioned above, datagrams can arrive out of order; this number is used to ensure that data is received in the order that it was sent). When establishing a connection, one program must assume the role of the client, and the other the server. The client is responsible for initiating the connection, wh
22、ile the servers responsibility is to wait, listen and respond to incoming connections. Once the connection has been established, both sides may send and receive data until the connection is closed.User Datagram ProtocolUnlike TCP, the User Datagram Protocol (UDP) does not present data as a stream of
23、 bytes, nor does it require that you establish a connection with another program in order to exchange information. Data is exchanged in discrete units called datagrams, which are similar to IP datagrams. In fact, the only features that UDP offers over raw IP datagrams are port numbers and an optiona
24、l checksum.UDP is sometimes referred to as an unreliable protocol because when a program sends a UDP datagram over the network, there is no way for it to know that it actually arrived at its destination. This means that the sender and receiver must typically implement their own application protocol
25、on top of UDP. Much of the work that TCP does transparently (such as generating checksums, acknowledging the receipt of packets, retransmitting lost packets and so on) must be performed by the application itself.With the limitations of UDP, you might wonder why its used at all. UDP has the advantage
26、 over TCP in two critical areas: speed and packet overhead. Because TCP is a reliable protocol, it goes through great lengths to insure that data arrives at its destination intact, and as a result it exchanges a fairly high number of packets over the network. UDP doesnt have this overhead, and is co
27、nsiderably faster than TCP. In those situations where speed is paramount, or the number of packets sent over the network must be kept to a minimum, UDP is the solution.译文如下:TCP/IP入门介绍作者 Catalyst DevelopmentCatalyst Development是全球公认的领先的互联网软件之一,其屡获殊荣的产品已广泛为世界各地成千上万的企业、政府和独立开发商所使用。绪论随着TCP/IP作为一种独立网络协议标
28、准平台逐渐的被认可,以及互联网的激增,在Windows环境下成为网络程序设计标准的Windows Sockets API (应用程序结口)已经步入舞台。在Windows Sockets编程之后,本文将介绍基本概念并且使用SocketWrench来实现你的第一个应用程序。Socketwrench是Catalyst软件开发的其中一部分,称之为SocketTools Visual Edition。SocketTools容纳了一些备受欢迎的互联网应用协议的组件及类库,如ftp ,pop3 , smtp和http。欲了解更多关于sockettools软件包,请访问Catalyst网站 。假定读者已经熟悉
29、可视化程序设计而且已经安装了SocketWrench控件,如果你对socket编程已经有所了解,那你可以跳过这一节的内容 当在利用Windows Sockets创建一个程序时,有两个基本途径。其中一个就是使用API函数编写代码。另外一种方式是通过设置属性和响应事件来使用所提供的更高层次的接口的组件。它提供了一种更加适当的编程接口,使用sockets编程可以避免许多易错点。在工程部件里包含了这个控件,设置它的属性和响应它的事件你可以更加迅速而容易的实现网络程序的应用。socketwrench提供了比较全面的Windows Sockets类库,并且在文章中的下一部分会被用来建立一个简单的客户机-服
30、务器应用。在开始利用该控件编程之前,我们先来学习一下通常sockets编程中基本术语和概念。传输控制协议当两台电脑之间想通过网络交换信息,在真正传输和接收数据之前,有几个组成部分是必须的。当然,物理硬件必须存在,像典型的网络接口卡(网卡)或一个拨号网络连接的串行通信端口。尽管如此,在这些物理连接之外,计算机之间同样也需要定义一些参数传递的协议。总之,一个协议定义了“信息通信的规则”,网络中的每台计算机必须遵循以便使所有的系统可以进行数据交换。在当今最流行的协议就是TCP/IP,也即传输控制协议。按照惯例,TCP/IP是一整套协议,都是基于互联网协议(IP协议)。不像一个单一的本地网,每个系统是
31、直接连接到对方,互联网是一个网络的集合,结合了单个的、虚拟的网络。互联网协议规定,如果在相同的物理网络中,在任何网络上的任何系统都能够很轻易的实现通信。每个系统,通常被称为主机,分配一个唯一的用来辨别的32位数字。通常情况下,这个地址通过点分为四个8位的数字。这就是所谓的点分法,类似“192.43.19.64”。其中有一部分地址用于识别网络系统连接的,而其余的是用来识别系统本身的。不对Internet 地址进行详细的了解了,只要知道主要的3“类”地址,如“A”,“B”和“C”。一般规则是“A”类地址被分配到一些非常大型的网络,“B”类地址被分配到中等规模的网络,而“C”类地址分配给小型网络(网
32、络少于有250台主机) 。当一个系统通过互联网协议发送数据时,所发送的不连续的单位即所谓的数据报,也被称为信息包。一个数据报是有报头和数据组成。报头包含了数据报要传递的目的地址的信息,就像一个信封,是用来书写地址、邮件处理。像邮件一样,不能保证数据报就能到达它的目的地。事实上,数据报在网络传输过程中也可能会出现丢失、重复或无序现象。不用说,这种不可靠性,可能会给软件开发人员造成很多问题。那怎么样才可以实现可靠的、直接的交换数据,而不出现信息报丢失或者无序的现象。传输控制协议(TCP)的发展就是为了满足这个需求。建立在IP基础上,TCP提供了一个可靠的、全双工的字节流可读可写类似于对文件的读写操
33、作。它的优点是显而易见的:程序员并不需要编写代码来处理丢失或无序的数据报,而是可以专注于应用程序本身。因为数据是作为一个字节流来保存的,使用TCP可以更加容易的修改和使用现有的代码。众所周知,TCP是面向连接的协议。在换句话说,在两个程序开始进行数据交换之前,他们必须建立一个连接 。采用三次握手在双方交换信息包并且建立初始的序号(序号是非常重要的,因为正如上文所述,数据可能出现无序现象,序号可以用来保证数据报发送时的顺序)。当建立连接后,其中一个程序要作为客户端的角色,而另一个要在作为服务器。客户端负责发起连接,而服务器的责任就是等待、倾听和回应连接。当连接建立成功,双方可以发送和接收数据,直
34、到连接关闭为止。用户数据报协议不像TCP协议,用户数据报协议(UDP)并不作以字节流的形式来显示数据,与其他程序交换数据时也不需要与另一个程序建立连接。以离散单元的形式交换的数据称之为数据报,类似于IP数据报。事实上,UDP唯一的特点就是所提供的原始IP数据报是端口号和可选的校验和。UDP有时被称为是一个不可靠的协议,因为在网络上一个程序发送一UDP数据报,是没有办法知道它是否确实到达它的目的地。这意味着发送者和接收者必须在UDP协议之上执行他们自己的应用协议。TCP的许多工作(如生成校验,确认收到的数据包,转发丢包等)必须由应用程序本身来体现出来。由于UDP的局限性,你可能会奇怪为什么它的使
35、用还是如此广泛。UDP与TCP相比存在着两个关键领域优势:速度和数据包开销。因为TCP是一个可靠的协议,这是不言而喻的,通过很长的报文来保证完整的数据到达它的目的地,结果导致了在网络传输中交换了大量的信息包。 UDP并没有这种开销,比起TCP来要快的多 。在这些情况下,速度显的极其重要,或者在网络中所发送的数据包必须保持最低水平,这就是UDP解决问题的关键。Client Server Programming with WinsockAuthor S.S. AhmedS.S. Ahmed is a senior IT Professional and works for a web and so
36、ftware development firm. Ahmed specializes in creating database driven dynamic web sites. He has been working with SharePoint for the last 3-4 years. He develops customized SharePoint solutions. Ahmed enjoys travelling and has been to many parts of the world. Web: Blog: IntroductionWinsock control c
37、omes with VB6 and is used to create applications that access the low-level functions of the Transmission Control Protocol/Internet Protocol (TCP/IP).Most of you might have worked with Internet Transfer Control which is very handy control when it comes to Internet Programming but there is another con
38、trol which even more robust and helps programmers creating more flexible applications. Winsock control comes with VB6 and is used to create applications that access the low-level functions of the Transmission Control Protocol/Internet Protocol (TCP/IP). TCP/IP is a specification that defines a serie
39、s of protocols used to standardize how computers exchange information with each other. TCP/IP provides communication across interconnected networks that use diverse hardware architectures and various operating systems. The protocols in TCP/IP are arranged in a series of layers known as a protocol st
40、ack. Each layer has its own functionality. Winsock is a standard that is maintained by Microsoft. This standard is basically a set of routines that describe communications from the TCP/IP stack. These routines reside in a dynamic link library that runs under Windows. The winsock DLL is interfaced wi
41、th TCP/IP and from there through the Internet.In this article, I am going to show how to use the winsock in a client server environment, we will create two separate applications, one of which will be a server and the other will be a client. Both client and server will interact with each other to exc
42、hange data. Client will send a request to the server and the server which will be connected to a database will retrieve the information requested by the client from the database and will return the requested information back to the client. You will base a database with this article, the database con
43、tains the item numbers and their prices. In real life situations, database might be located on a machine different from the one that hosts and client application. Ports & the WinSock ControlI think it would be better to talk about the ports before we proceed any further. A port is a special memory l
44、ocation that exists when two computers are in communication via TCP/IP. Applications use a port number as an identifier to other computers, both the sending and receiving computers use this port to exchange data. To make the job of communication easier, some port numbers have been standardized. Thes
45、e standard port numbers have no inherent value other than that users have agreed to use them with certain applications. Table below lists a number of popular and publicly accepted port numbers and their corresponding applications.Service Port HTTP80FTP20,21Gopher70SMTP25POP3110Telnet 23Finger 79Loca
46、l loops/callbacks 0Using the Winsock ControlWinsock is above the TCP/IP protocol stack in the ISO/OSI model. TCP/IP is an industry standard communication protocol that defines methods for packaging data into packets for transmission between computing devices on a heterogeneous network. TCP/IP is the
47、 standard for data transmission over networks, including the Internet. TCP establishes a connection for data transmission and IP defines the method for sending data packets.The Microsoft Winsock control makes using the TCP/IP a breeze. Microsoft has wrapped up the Winsock and INetAPI API calls into
48、a nice neat package that you can easily incorporate into your Visual Basic applications.Winsock Operating ModesThe Transport layer (also known as the Host-to-Host Transport layer) is responsible for providing the Application layer with session and datagram communication services. The core protocols of the Transport layer are TCP and User Datagram Protocol (UDP). The Winsock control supports the following two operating modes: sckTCPProtocol sckUDPProtocol WinSock Properties & EventsWi