1、 毕业设计 (论文 )外文文献翻译 译文一 : Introduction to TCP/IP Introduction 译文二 : Client Server Programming with Winsock 学生姓名 学 号 系 别 信息与电子系 专业 班级 计算机科学与技术 Introduction to TCP/IP Introduction Author Catalyst Development Catalyst Development is a recognized leader in Internet component software whose award-winning p
2、roducts are used by thousands of corporate, government and independent developers around the world. Introduction With 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 em
3、erged 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 S
4、ocketTools 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 wi
5、th 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 t
6、o 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 c
7、ontrol 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
8、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
9、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
10、 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 Cont
11、rol 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 net
12、work. 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. Ty
13、pically, 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 system itself. Without going
14、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
15、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
16、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
17、 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 o
18、r 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 progra
19、mmer 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 w
20、ords, 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, datagra
21、ms 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 Protocol