Commit 06c4b97c authored by zhushanglei's avatar zhushanglei

websocket和tcpsocket

parent 94fe404f
...@@ -23,7 +23,7 @@ public class WebSocketHandler extends SimpleChannelInboundHandler<Object> { ...@@ -23,7 +23,7 @@ public class WebSocketHandler extends SimpleChannelInboundHandler<Object> {
}else { }else {
msg = String.valueOf(object); msg = String.valueOf(object);
} }
System.out.println("msg:"+msg); logger.info("msg:"+msg);
for (String key: map.keySet()) { for (String key: map.keySet()) {
if (key.equals(ctx.channel().id().toString())){ if (key.equals(ctx.channel().id().toString())){
...@@ -58,7 +58,7 @@ public class WebSocketHandler extends SimpleChannelInboundHandler<Object> { ...@@ -58,7 +58,7 @@ public class WebSocketHandler extends SimpleChannelInboundHandler<Object> {
@Override @Override
public void exceptionCaught(ChannelHandlerContext ctx, Throwable cause) throws Exception { public void exceptionCaught(ChannelHandlerContext ctx, Throwable cause) throws Exception {
System.out.println("exceptionCaught::"+cause.getMessage()); logger.error("exceptionCaught::"+cause.getMessage());
String clientId = ctx.channel().id().toString(); String clientId = ctx.channel().id().toString();
map.remove(clientId); map.remove(clientId);
ctx.close(); ctx.close();
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment