mechanical man Overview Dongsu Han 1 Outline Java earnings programme overview Android Overview Android Emulator Overview Project Overview acquiring Started 2 Java Network Programming Java.net.* programming object lesson Blocking model, you wait until work is d wholeness, maybe forever whiz roam required per connection Socket exposes introduce and release menstruation Java.nio.* programming model Introduced in Java 1.4, non-blocking IO cutting-made Interface: SocketChannel (in java.nio.channels) Reading/ report via Buffer objects rather than stimulant/yield electric currents Select() implemented 3 Java.net.* Socket API Part of the java.net package substance java.net.*; Provides two secernatees of sockets for transmission control protocol Socket : client font of socket ServerSocket : server side of socket Provides unitary socket type for UDP DatagramSocket 4 Java.net.Socket devising a connection Socket s = new Socket(hostname, port); The builder not only creates a socket, but makes a TCP connection. Socket exposes infix and output stream. s.getOutputStream() s.getInputStream() Most of the time youll chain the input/output stream to some other input/output stream or reader object to more considerably supervise the information. 5 Java.net.

Socket Create a print stream for piece of music OutputStream rawOut = socket.getOutputStream(); PrintStream cut down = new PrintStream(rawOut); Create a data output stream for writing BufferedOutputStream buffOut = new BufferedOutputStream(raw Out); out =new DataOutputStream(buffOut); ! Create a data input stream for class period DataInputStream din = new DataInputStream(socket.getInputStream()); 6 Java.net.ServerSocket Server incline socket To abet multiple clients servers have at least one thread per client ServerSocket svr = new ServerSocket(port); while (Socket s = svr.accept()) { new EchoThread(s).start(); } 7 Java.net and Thread class EchoThread extends Thread { EchoThread(Socket s) { ... }...If you want to get a full essay, separate it on our website:
OrderCustomPaper.comIf you want to get a full essay, visit our page:
write my paper
No comments:
Post a Comment