cl.java
来自「java socket server,对初学者很好的参考意义」· Java 代码 · 共 44 行
JAVA
44 行
// test of the client class// Keith Vertanen, 11/98import java.io.*;import java.net.*;import Client;public class cl { static int SIZE = 1024; // how big the array of data is static int ITERS = 20; // how many messages to bounce back and forth public static void main( String args[] ) throws IOException { // connect to the server, first number is the port, second // is the system name, third is whether you want reversed // bytes or not Client myclient = new Client(5007, "bee12.cs.orst.edu", 1); System.out.println(myclient.recv_string('\n')); myclient.send_string("We read you 5 by 5\n"); double C[]; C = new double[SIZE]; for (int i=0; i<SIZE; i++) C[i] = 0.0; for (int i=0; i<ITERS; i++) { myclient.recv_doubles(C, SIZE); myclient.send_doubles(C, SIZE); System.out.print(i+" "); } myclient.closesocket(); }}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?