add logicface: TcpTransport

This commit is contained in:
free will
2021-04-16 15:36:37 +08:00
parent f517f1aa1a
commit d1a1336f37
+33
View File
@@ -0,0 +1,33 @@
package logicface;
import java.io.IOException;
import java.nio.channels.SocketChannel;
/*
* @Author: Wang Feng
* @Description:
* @Version: 1.0.0
* @Date: 15:30 2021/4/16
* @Copyright: MIN-Group;国家重大科技基础设施——未来网络北大实验室;深圳市信息论与未来网络重点实验室
*/
public class TcpTransport extends StreamTransport{
/**
* 初始化TcpTransport
* @param channel
*/
public void init(SocketChannel channel) throws LogicFaceException {
try {
this.channel=channel;
this.localAddr=channel.getLocalAddress().toString();
this.localUri="tcp://"+this.localAddr;
this.remoteAddr=channel.getRemoteAddress().toString();
this.remoteUri="tcp://"+this.remoteAddr;
this.recvBuf=new byte[1024*1028*4];
this.recvLen=0;
} catch (IOException e) {
throw new LogicFaceException("TcpTransport.init: "+e.getMessage());
}
}
}