forked from KNEMC/KLALB
增加流量控制
增加自动按延迟选择线路
This commit is contained in:
@@ -2,11 +2,13 @@ package org.kne.cloud.network.klalb;
|
||||
|
||||
import java.io.BufferedInputStream;
|
||||
import java.io.BufferedOutputStream;
|
||||
import java.io.EOFException;
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.net.ConnectException;
|
||||
import java.net.MalformedURLException;
|
||||
import java.net.Socket;
|
||||
import java.net.SocketTimeoutException;
|
||||
import java.net.URI;
|
||||
import java.net.URL;
|
||||
import java.net.UnknownHostException;
|
||||
@@ -37,8 +39,9 @@ public class KLALBClient {
|
||||
LocalTCPConnection tcc = null;
|
||||
try {
|
||||
tcc = new LocalTCPConnection(s);
|
||||
tcc.setServiceElement(sel);
|
||||
System.out.println("TCP:"+tcc.getCuid()+"已连接");
|
||||
iom.handleLocal(tcc,sel,true);
|
||||
iom.handleLocal(tcc,true);
|
||||
System.out.println("TCP:"+tcc.getCuid()+"已关闭");
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
@@ -64,12 +67,17 @@ public class KLALBClient {
|
||||
tc.getDout().writeLong(suid.getMostSignificantBits());
|
||||
tc.getDout().writeLong(suid.getLeastSignificantBits());
|
||||
tc.getDout().flush();
|
||||
int v=tc.getDin().read();
|
||||
if(v==-1) {
|
||||
throw new EOFException();
|
||||
}
|
||||
System.out.println(tll+":连接成功");
|
||||
iom.handleRemote(tc);
|
||||
System.out.println(tll+":连接断开");
|
||||
} catch (UnknownHostException e) {
|
||||
e.printStackTrace();
|
||||
}catch(ConnectException e) {
|
||||
}catch(ConnectException|SocketTimeoutException e) {
|
||||
}catch(EOFException e) {
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}finally {
|
||||
|
||||
Reference in New Issue
Block a user