Java Networking
http://tutorials.jenkov.com/java-networking/index.html
Java standard IO works with byte streams and character streams, blocking.
How to create a TCP socket to connect to a server?
Use Socket, getOutputStream, write, flush then close.
Use Socket, getInputStream, read, in.close, socket.close.
How to create a server that listens to incoming TCP connections?
Use ServerSocket, accept, socket.close, serverSocket.close.
How to send data using UDP socket?
Prepare new byte[65508], InetAddress.getByName and DatagramPacket
Use DatagramSocket().send(DatagramPacket)
How to receive data using UDP socket?
Use DatagramSocket to specify the UDP port, byte[], DatagramPacket.receive which is a blocking method.
How to read the HTTP web content?
Use URL and URLConnection.getInputStream
How to create an IP address?
Use InetAddress.getByName("google.com"), getByName("1.2.3.4") or getLocalHost()
Java NIO
http://tutorials.jenkov.com/java-nio/index.html
Java NIO works with channels and buffers, non-blocking, selectors.
A single thread uses a single selector that monitors multiple channels for events like connection opened or data arrived.
Java NIO core classes: Channel, Buffer, Selector
For Channel, the implementations are FileChannel, DatagramChannel, SocketChannel, ServerSocketChannel.
For Buffer, the implementations are ByteBuffer, CharBuffer, DoubleBuffer, FloatBuffer, IntBuffer, LongBuffer, ShortBuffer. They are essentially the 8 Java primitives except Boolean.
2016年10月18日 星期二
2016年10月13日 星期四
CPU Marks Windows Experience Index and Sis
Intel i3 2100 3.1Ghz 2 core 4 thread using, with graphic
8GB but 32 bit 2.88GB usable
Intel Graphics Family
X200 P8600 2.4Ghz 4GB
MBP 2010
Macbook pro 13 2010 Mid 2.4Ghz P8600 4GB DDR3 1066Mhz 320M 256MB
Intel HD Graphics 3000
Win 7 | i3 2100 | MBA2011 | x200 | A8-5500 | G620 |
CPU | 7.1 | 6.8 | 6 | 7.2 | 6.4 |
RAM | 5.5 | 5.9 | 5.9 | 5.9 | 5.5 |
Aero | 4.6 | 5.6 | 4.1 | 6.7 | 4.3 |
Graphics | 5.6 | 6.2 | 3.4 | 6.7 | 5.7 |
Disk | 7.1 | 7.2 | 5.9 | 5.9 | 5.9 |
Sis | i3 | MBA2011 |
Media MPixel/s | 72 | 60 |
AES GB/s | 0.24 | 1.483 |
finance kOPT/s | 6.21 | 4.09 |
Science GFLOPS | 6.32 | 4.59 |
.NET GOPS | 7.82 | 7.19 |
Memory GB/s | 17.9 | 12.2 |
Memory late ns | 25.5 | 31.2 |
Disk MB/s | 173 | 219 |
Disk IOPS | 4786 | 1431 |
i3 | i5 2557m | P8600 | |||
GeekBench 3 | 4786 | 4023 | 2303 | ||
Dual-Core A4-6300 | 2258 | 2088 | 1388 | ||
AMD | A4-6300 Dual | x4 860K | A10-7850K | A8 7650K | A8 6600k |
Price | $266 | $526 | $789 | $674 | |
GeekBench 3 | 2972 | 7520 | 7022 | 6071 | |
GeekBench 3 Single Core | 1913 | 2478 | 2328 | 2132 |
訂閱:
文章 (Atom)