J'ai essayé d'insérer lz4 entre les deux pour augmenter la vitesse réelle de la ligne AIR de la zone A au bureau. Par conséquent, il était nécessaire de disposer d'un mécanisme d'envoi et de réception d'entrée / sortie standard via TCP. J'ai trouvé le meilleur outil en le recherchant nc (netcat) (Voir l'appareil http://www.intellilink.co.jp/sites/default/files/imported/article/column/sec-network01.png) Cependant, si vous le téléchargez dans la zone A, il sera lancé par Buster. Je ne peux pas l'ignorer et juste enregistrer que j'ai créé ce type avec JAVA.
PG:
ncJava.java
package ncjava;
import java.net.InetAddress;
import java.net.ServerSocket;
import java.net.Socket;
public class ncJava {
	public static void main(String[] args) throws Exception{
		if (args.length!=2) {
			System.err.println(
					"USAGE: ncJava toSTD/toTCP TCPIP:PORT"
					);
			return;
		}
		if (args[0].toUpperCase().equals("TOSTD")) {
			//Server TCP to STDOUT
			ServerSocket ss = new ServerSocket(
					new Integer(args[1].replaceAll("^([^:]+):(.+)$", "$2")) //PortPart
					,0
					,InetAddress.getByName(args[1].replaceAll("^([^:]+):(.+)$", "$1")) //IPpart
					);
			Socket as = null;
			System.err.println("stby:"+ss+" to STDOUT");
			try {
			  while((as = ss.accept()) != null ) {
				System.err.println("recive from TCP:"+as);
				byte buf[] = new byte[1024];
				int r = 0;
				while ((r=as.getInputStream().read(buf))!=-1) {
					System.out.write(buf,0,r);
					System.out.flush();
				}
				System.err.println("disconnect TCP:"+as);
			  }
			} finally {if (ss != null) ss.close();}
			return;
		}else if (args[0].toUpperCase().equals("TOTCP")) {
			//Server STDIN to TCP
			Socket sc = new Socket(
					InetAddress.getByName(args[1].replaceAll("^([^:]+):(.+)$", "$1")) //IPpart
					,new Integer(args[1].replaceAll("^([^:]+):(.+)$", "$2")) //PortPart
					);
			System.err.println("stby to:"+sc+" from STDIN");
			try {
				byte buf[] = new byte[1024];
				int r = 0;
				while ((r=System.in.read(buf))!=-1) {
					System.err.println("recive from STDIN:"+r);
					sc.getOutputStream().write(buf,0,r);
					sc.getOutputStream().flush();
				}
				System.err.println("disconnect STDIN:");
			} finally {if (sc != null) sc.close();}
			return;
		}
	}
}
résultats de test: Expéditeur E:\MrServer>echo "testa" |java -jar ncJava.jar TOTCP localhost:9999 stby to:Socket[addr=localhost/127.0.0.1,port=9999,localport=54726] from STDIN recive from STDIN:10 disconnect STDIN:
E:\MrServer> Receveur E:\MrServer>java -jar ncJava.jar TOSTD localhost:9999 stby:ServerSocket[addr=localhost/127.0.0.1,port=0,localport=9999] to STDOUT recive from TCP:Socket[addr=/127.0.0.1,port=54726,localport=9999] "testa" disconnect TCP:Socket[addr=/127.0.0.1,port=54726,localport=9999]
Expéditeur E:\MrServer>type file.txt "engbJapan" "hhhhhhh"
E:\MrServer>java -jar ncJava.jar TOTCP localhost:9999 <file.txt stby to:Socket[addr=localhost/127.0.0.1,port=9999,localport=54728] from STDIN recive from STDIN:26 disconnect STDIN:
E:\MrServer> Receveur recive from TCP:Socket[addr=/127.0.0.1,port=54728,localport=9999] "engbJapan" "hhhhhhh" disconnect TCP:Socket[addr=/127.0.0.1,port=54728,localport=9999]
c'est tout.
Recommended Posts