使用mina框架写了一个android客户端通过路由器连接服务器连不上是怎么回事 10
publicvoidonCreate(BundlesavedInstanceState){super.onCreate(savedInstanceState);setCo...
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
IoConnector connector = new NioSocketConnector();
connector.setConnectTimeout(30000);
connector.getFilterChain().addLast( "codec",new ProtocolCodecFilter(new TextLineCodecFactory(Charset.forName("UTF-8"), LineDelimiter.WINDOWS.getValue(),
LineDelimiter.WINDOWS.getValue())));
connector.setHandler(new DemoClientHandler());
IoSession session = null;
try {
ConnectFuture future = connector.connect(new InetSocketAddress(HOST, PORT));
future.awaitUninterruptibly();
session = future.getSession();
session.write("mina");
} catch (Exception e) {
} 展开
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
IoConnector connector = new NioSocketConnector();
connector.setConnectTimeout(30000);
connector.getFilterChain().addLast( "codec",new ProtocolCodecFilter(new TextLineCodecFactory(Charset.forName("UTF-8"), LineDelimiter.WINDOWS.getValue(),
LineDelimiter.WINDOWS.getValue())));
connector.setHandler(new DemoClientHandler());
IoSession session = null;
try {
ConnectFuture future = connector.connect(new InetSocketAddress(HOST, PORT));
future.awaitUninterruptibly();
session = future.getSession();
session.write("mina");
} catch (Exception e) {
} 展开
1个回答
展开全部
and pink to near-white, and transparen
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
Storm代理
2023-07-25 广告
2023-07-25 广告
StormProxies是一家可靠的代理服务提供商,提供原生IP(住宅原生IP)和高匿名代理服务。以下是关于StormProxies的原生IP服务的一些信息:1. 住宅原生IP:StormProxies提供的住宅原生IP是指从真实的家庭或企...
点击进入详情页
本回答由Storm代理提供
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询