计算机毕业设计(论文)外文翻译.doc_第1页
计算机毕业设计(论文)外文翻译.doc_第2页
计算机毕业设计(论文)外文翻译.doc_第3页
计算机毕业设计(论文)外文翻译.doc_第4页
计算机毕业设计(论文)外文翻译.doc_第5页
已阅读5页,还剩9页未读 继续免费阅读

下载本文档

版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领

文档简介

毕业设计(论文)外文文献翻译(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 component 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 (application 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 developed 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 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 against 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 programming. 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 application 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 components 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 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 stands 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 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 identify 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 4. some parts of the address are used to identify the network that the system is connected to, and the remainder identifies the system 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, 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 followed 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 destination. 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 worry 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: 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-oriented 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 mentioned 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, while 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 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 optional 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 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 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 considerably 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作为一种独立网络协议标准平台逐渐的被认可,以及互联网的激增,在windows环境下成为网络程序设计标准的windows sockets api (应用程序结口)已经步入舞台。在windows sockets编程之后,本文将介绍基本概念并且使用socketwrench来实现你的第一个应用程序。socketwrench是catalyst软件开发的其中一部分,称之为sockettools visual edition。sockettools容纳了一些备受欢迎的互联网应用协议的组件及类库,如ftp ,pop3 , smtp和http。欲了解更多关于sockettools软件包,请访问catalyst网站 。假定读者已经熟悉可视化程序设计而且已经安装了socketwrench控件,如果你对socket编程已经有所了解,那你可以跳过这一节的内容 当在利用windows sockets创建一个程序时,有两个基本途径。其中一个就是使用api函数编写代码。另外一种方式是通过设置属性和响应事件来使用所提供的更高层次的接口的组件。它提供了一种更加适当的编程接口,使用sockets编程可以避免许多易错点。在工程部件里包含了这个控件,设置它的属性和响应它的事件你可以更加迅速而容易的实现网络程序的应用。socketwrench提供了比较全面的windows sockets类库,并且在文章中的下一部分会被用来建立一个简单的客户机-服务器应用。在开始利用该控件编程之前,我们先来学习一下通常sockets编程中基本术语和概念。传输控制协议当两台电脑之间想通过网络交换信息,在真正传输和接收数据之前,有几个组成部分是必须的。当然,物理硬件必须存在,像典型的网络接口卡(网卡)或一个拨号网络连接的串行通信端口。尽管如此,在这些物理连接之外,计算机之间同样也需要定义一些参数传递的协议。总之,一个协议定义了“信息通信的规则”,网络中的每台计算机必须遵循以便使所有的系统可以进行数据交换。在当今最流行的协议就是tcp/ip,也即传输控制协议。按照惯例,tcp/ip是一整套协议,都是基于互联网协议(ip协议)。不像一个单一的本地网,每个系统是直接连接到对方,互联网是一个网络的集合,结合了单个的、虚拟的网络。互联网协议规定,如果在相同的物理网络中,在任何网络上的任何系统都能够很轻易的实现通信。每个系统,通常被称为主机,分配一个唯一的用来辨别的32位数字。通常情况下,这个地址通过点分为四个8位的数字。这就是所谓的点分法,类似“4”。其中有一部分地址用于识别网络系统连接的,而其余的是用来识别系统本身的。不对internet 地址进行详细的了解了,只要知道主要的3“类”地址,如“a”,“b”和“c”。一般规则是“a”类地址被分配到一些非常大型的网络,“b”类地址被分配到中等规模的网络,而“c”类地址分配给小型网络(网络少于有250台主机) 。当一个系统通过互联网协议发送数据时,所发送的不连续的单位即所谓的数据报,也被称为信息包。一个数据报是有报头和数据组成。报头包含了数据报要传递的目的地址的信息,就像一个信封,是用来书写地址、邮件处理。像邮件一样,不能保证数据报就能到达它的目的地。事实上,数据报在网络传输过程中也可能会出现丢失、重复或无序现象。不用说,这种不可靠性,可能会给软件开发人员造成很多问题。那怎么样才可以实现可靠的、直接的交换数据,而不出现信息报丢失或者无序的现象。传输控制协议(tcp)的发展就是为了满足这个需求。建立在ip基础上,tcp提供了一个可靠的、全双工的字节流可读可写类似于对文件的读写操作。它的优点是显而易见的:程序员并不需要编写代码来处理丢失或无序的数据报,而是可以专注于应用程序本身。因为数据是作为一个字节流来保存的,使用tcp可以更加容易的修改和使用现有的代码。众所周知,tcp是面向连接的协议。在换句话说,在两个程序开始进行数据交换之前,他们必须建立一个连接 。采用三次握手在双方交换信息包并且建立初始的序号(序号是非常重要的,因为正如上文所述,数据可能出现无序现象,序号可以用来保证数据报发送时的顺序)。当建立连接后,其中一个程序要作为客户端的角色,而另一个要在作为服务器。客户端负责发起连接,而服务器的责任就是等待、倾听和回应连接。当连接建立成功,双方可以发送和接收数据,直到连接关闭为止。用户数据报协议不像tcp协议,用户数据报协议(udp)并不作以字节流的形式来显示数据,与其他程序交换数据时也不需要与另一个程序建立连接。以离散单元的形式交换的数据称之为数据报,类似于ip数据报。事实上,udp唯一的特点就是所提供的原始ip数据报是端口号和可选的校验和。udp有时被称为是一个不可靠的协议,因为在网络上一个程序发送一udp数据报,是没有办法知道它是否确实到达它的目的地。这意味着发送者和接收者必须在udp协议之上执行他们自己的应用协议。tcp的许多工作(如生成校验,确认收到的数据包,转发丢包等)必须由应用程序本身来体现出来。由于udp的局限性,你可能会奇怪为什么它的使用还是如此广泛。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 software 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: /ssa.introductionwinsock 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).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 control 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 series 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 stack. 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 with 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 exchange 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 contains 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 location 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. these 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 79local 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 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 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 & eventswinsock enables you to create clients and servers using the same control. this dual functionality enables you to specify through property setting the type of application you will be building. the winsock control uses a number of the same properties, whether you are creating client or a server, thereby all but eliminating the learning curve needed to create applications. some of the important properties of the control are as following:bytesreceived propertythis property returns the number of bytes currently in the receive buffer. this is a read-only property and is unavailable at design time. the value returned is a long integer.localhostname propertythe localhostname property returns the name of the local host system. this is read-only property and is unavailable at the design time. the value returned is a string. localip propertythe localip property returns the local host system ip address in the form of a string, such as 27. this property is read-only and is unavailable at design time. localport propertythis property returns or sets the local port number. this can be both read from and written to and is available at both design time and runtime. the value returned is a long integer.protocol propertyreturns or sets the protocol, either tcp or udp, used by the winsock control.remotehost propertythe remotehost property returns or sets the remote host. this can be both read from and written to and is available both in design time and runtime. the value returned is a string and can be specified either as an ip address or as a dns name.remoteport propertythis property returns or sets the remote port number.state propertythis returns the state of the control as expressed by an enumerated list. this is read-only property and is unavailable at design time.some of the important methods of winsock control are as following:accept methodit accepts the request for connection from the client system. for this method to be used, the control must be in the listening state.close methodthe close method terminates a tcp connection from either the client or server applications.getdata methodgetdata is the method that retrieves the current block of data from the buffer and then stores it in a variable of the variant type. peekdata methodthe peekdata method operates in a fashion similar to the getdata method. however, it does not remove data from the input queue.listen methodthis is invoked on the server application to have the server application wait for a tcp request for connection from a client system.senddata methodthis method dispatches data to the remote computer. it is used for both the client and server systems.connect methodthe connect method requests a connection to a remote computer.i am not going to discuss events here. you can find the complete details of events on the microsoft site.译文如下:使用winsock客户端/服务器编程介绍作者 s.

温馨提示

  • 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
  • 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
  • 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
  • 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
  • 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
  • 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
  • 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。

评论

0/150

提交评论