毕业设计论文-外文文献翻译.doc
《毕业设计论文-外文文献翻译.doc》由会员分享,可在线阅读,更多相关《毕业设计论文-外文文献翻译.doc(18页珍藏版)》请在三一办公上搜索。
1、毕业设计(论文)外文参考文献翻译 计算机科学与信息工程系 系(院) 2008 届题 目 企 业 即 时 通 Instant Messaging for Enterprises 课题类型 技术开发 课题来源 自 选 学生姓名 许帅 专业班级 04计算机科学与技术 指导老师 王占中 职 称 工程师 完成日期: 2008年 4 月 6 日目 录Instant Messaging for Enterprise11. Tips12. Introduction13. First things first24.The While-Accept loop45. Per-Thread class66. The
2、Client class7企业即时通91.提示92.简介93.首先第一件事104.监听循环115.单线程类136.用户端类14Instant Messaging for Enterprise1. TipsIf Java is, in fact, yet another computer programming language, you may question why it is so important and why it is being promoted as a revolutionary step in computer programming. The answer isnt
3、immediately obvious if youre coming from a traditional programming perspective. Although Java is very useful for solving traditional standalone programming problems, it is also important because it will solve programming problems on the World Wide Web. What is the Web?The Web can seem a bit of a mys
4、tery at first, with all this talk of “surfing,” “presence,” and “home pages.” Its helpful to step back and see what it really is, but to do this you must understand client/server systems, another aspect of computing that is full of confusing issues. The primary idea of a client/server system is that
5、 you have a central repository of information, some kind of data, often in a database。That you can distribute on demand to some set of people or machines. The basic concept of client/server computing, then, is not so complicated. The problems arise because you have a single server trying to serve ma
6、ny clients at once.Building a java chat serverShould I take this tutorial?in this tutorial, we will build both the server and client sides of a simple chat system this tutorial is for someone with little or no experience doing networking programming. Well cover topics such as networking and multithr
7、eading in enough detail so that youll be able to follow the examples, even if you have little or no experience doing this kind of programming. You will, however, need to be familiar with basic object-oriented programming in the Java language. In this tutorial, youll build a simple, centralized, conn
8、ection-oriented Java server. In doing so, youll learn a basic framework that you can use when creating such a server, using time-honored techniques that work well in many situations.2. IntroductionWell also examine some of the limitations of this framework and explore ways of getting around them.Wha
9、t is a connection-oriented server?Generally speaking, the job of any server is to provide a centralized service. However, there are many different ways of providing services, and many different ways to structure the communications. Chat is roughly described as a connection-oriented service, because
10、a user establishes a connection and maintains that connection, sending and receiving text for the duration of the session. Well be creating a stripped-down, connection-oriented server. Learning the basic framework will help you a great deal in creating other connection-oriented servers in the future
11、.Why create from scratch?In creating this prototype server, well be using nothing more than the basic packages built into every Java implementation. This allows us to explore server programming at the very lowest level possible in the Java language.There are certainly many systems available that can
12、 take care of many of these networking details for you. In many cases, the best real-world solution is to use an existing framework, because it often provides useful features such as fault-tolerance, load-balancing.What does the server do?Before we describe the Listener class, well describe the serv
13、er. Doing so has a certain chronological elegance, because in our running system, the server will have to start before any of the clients can connect to it.Our server will be a stand-alone program - a single Java process running on its own machine. It wont require any support software other than a J
14、ava virtual machine. And it wont require a Web server or application server, although a Web server or application server will likely be used to serve the client applet to the client.More advanced server systems often embed the server code within a larger framework. This framework might be used to su
15、pply features such as load balancing, special libraries for handling large numbers of clients, process migration, and database services。However, our example is going to stand all by itself. It will take care of all networking responsibilities on its own. As well see, this isnt very hard.3. First thi
16、ngs firstListening on a portThe first thing we have to do is to get ready to receive incoming connections. To do this, we must listen on a port.A port can be thought of as an address within a single computer. Remember that often a single machine might serve as a Web server, a chat server, an FTP ser
17、ver, and several other kinds of servers at the same time. Because of this, a connection to a server needs to specify not only the address of the machine itself, but also the particular service within the machine. This internal address is a port and is represented by a single integer between 1 and 65
18、535.SocketsOur communications between client and server will pass through a Java object called a Socket. Sockets are not at all Java-specific; the term is taken directly from the terminology of general IP (Internet Protocol) network programming. In Java programs, a Socket object is simply a wrapper
19、around the low-level。The most important thing to know about a Socket object is that it contains (among other things) two Streams. One is for reading data coming in, and the other is for writing data out.That is to say, a Socket has an InputStream and an OutputStream.(If these Stream classes are unfa
20、miliar to you, then suffice it to say that they are objects used for reading and writing data, often as a stream of bytes. If you dont know about them yet,you really should. See the java.io package for more information.)So, now we get to the first of our seven elements, the Listener Class. Well call
21、 it Server.java.The next few panels will show the essential elements of this class: the constructor and the main() routine.The constructor for Server takes a single parameter - a port number. This tells us what port to listen on when we are ready to start accepting connections. Here is the construct
22、or:public Server( int port ) throws IOException / All we have to do is listenlisten( port );The main() routineWell also include a main() routine so that this Server class can be used as its own stand-alone application. In practice, you might be embedding your basic server code in something larger, i
23、n which case you already have a main(). But for our purposes, the Server is all there is. Heres the main() routine:/ Main routine/ Usage: java Server portstatic public void main( String args ) throws Exception / Get the port # from the command lineint port = Integer.parseInt( args0 );/ Create a Serv
24、er object, which will automatically begin/ accepting connections.new Server( port );Now that were all ready to listen, well continue to the next section to see how we accept new connections and what we do with them.4.The While-Accept loopWere ready to start accepting network connections from our cli
- 配套讲稿:
如PPT文件的首页显示word图标,表示该PPT已包含配套word讲稿。双击word图标可打开word文档。
- 特殊限制:
部分文档作品中含有的国旗、国徽等图片,仅作为作品整体效果示例展示,禁止商用。设计者仅对作品中独创性部分享有著作权。
- 关 键 词:
- 毕业设计 论文 外文 文献 翻译
链接地址:https://www.31ppt.com/p-3879740.html