freepeople性欧美熟妇, 色戒完整版无删减158分钟hd, 无码精品国产vα在线观看DVD, 丰满少妇伦精品无码专区在线观看,艾栗栗与纹身男宾馆3p50分钟,国产AV片在线观看,黑人与美女高潮,18岁女RAPPERDISSSUBS,国产手机在机看影片

正文內(nèi)容

企業(yè)即時(shí)通外文文獻(xiàn)翻譯-wenkub

2023-05-19 16:57:01 本頁面
 

【正文】 we are ready to start accepting connections. Here is the constructor: public Server( int port ) throws IOException { // All we have to do is listen listen( port )。t very hard. 3. First things first Listening on a port The first thing we have to do is to get ready to receive ining connections. To do this, we must listen on a port. A port can be thought of as an address within a single puter. Remember that often a single machine might serve as a Web server, a chat server, an FTP server, 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 3 service within the machine. This internal address is a port and is represented by a single integer between 1 and 65535. Sockets Our munications between client and server will pass through a Java object called a Socket. Sockets are not at all Javaspecific。t require any support software other than a Java virtual machine. And it won39。ll also examine some of the limitations of this framework and explore ways of getting around them. What is a connectionoriented server? Generally speaking, the job of any server is to provide a centralized service. However, there are many 2 different ways of providing services, and many different ways to structure the munications. Chat is roughly described as a connectionoriented service, because a user establishes a connection and maintains that connection, sending and receiving text for the duration of the session. We39。 That you can distribute on demand to some set of people or machines. The basic concept of client/server puting, then, is not so plicated. The problems arise because you have a single server trying to serve many clients at once. Building a java chat server Should 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 working programming. We’ll cover topics such as working and multithreading in enough detail so that you39。ll 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 objectoriented programming in the Java language. In this tutorial, you39。ll be creating a strippeddown, connectionoriented server. Learning the basic framework will help you a great deal in creating other connectionoriented servers in the future. Why create from scratch? In creating this prototype server, we39。t 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 supply features such as load balancing, special libraries for handling large numbers of clients, process migration, and database services。 the term is taken directly from the terminology of general IP (Inter Protocol) work programming. In Java programs, a Socket object is simply a wrapper around the lowlevel。 } The main() routine We39。 } Now that we39。s how the chat is going to work. We mentioned above that the Java language provides an object called a Socket, which represents a connection to a program somewhere else and through which data can pass. But how do we get this socket in the first place? A client, almost by definition, initiates the connection to a server. Therefore, the first job of a server is to wait for a connection to e in. That is, we need something to give us the Sockets that are connected to our clients. That39。re still trying to deal with the connections as they arrive. Here39。ve dealt with this connection, you call accept() and get the next one. This way, no matter how fast connections are ing, and no matter how many processors or work interfaces your machine has, you get the connections one at a time. (And if there aren39。t pile up. The code Let39。 // Tell the world we39。ve got it ( Connection from +s )。 // Create a new thread for this connection, and then forget // about it new ServerThread( this, s )。d want to use threads in your program, but there is one reason most pertinent to the construction of a chat server: input/output. Your chat server is municating (in a sense) with the users at the client. Users are usually much slower than servers, which means that your server code is going to spend a lot of time simply waiting for users to say things. And you never know who is going to say something first. If you have a single thread, and it39。s the code:: // Constructor. public ServerThread( Server server, Socket socket ) { // Save the parameters = server。ve gotten to the point where we39。s very easy to do,and because there39。re assuming that one of the reasons you39
點(diǎn)擊復(fù)制文檔內(nèi)容
畢業(yè)設(shè)計(jì)相關(guān)推薦
文庫吧 www.dybbs8.com
備案圖片鄂ICP備17016276號(hào)-1