Home > other >  UDP ports to disappear
UDP ports to disappear

Time:10-05

Recently wrote a udp communication program with mina, just start everything is normal, a few disappear will appear port, after the restart normal, see the error log as follows
Java nio. Channels. ClosedChannelException: null
At sun. Nio. Ch. DatagramChannelImpl. EnsureOpen (DatagramChannelImpl. Java: 320)
At sun. Nio. Ch. DatagramChannelImpl. Send (428) DatagramChannelImpl. Java:
The at org. Apache. Mina. Transport. Socket. Nio. NioDatagramAcceptor. Send (NioDatagramAcceptor. Java: 753)
The at org. Apache. Mina. Transport. Socket. Nio. NioDatagramAcceptor. Write (NioDatagramAcceptor. Java: 875)
The at org. Apache. Mina. Transport. Socket. Nio. NioDatagramAcceptor. Write (NioDatagramAcceptor. Java: 68)
The at org. Apache. Mina. Core. Filterchain. DefaultIoFilterChain $HeadFilter. FilterWrite (DefaultIoFilterChain. Java: 751)
The at org. Apache. Mina. Core. Filterchain. DefaultIoFilterChain. CallPreviousFilterWrite (DefaultIoFilterChain. Java: 625)
At org. Apache. Mina. Core. Filterchain. DefaultIoFilterChain. Access the $1500 (DefaultIoFilterChain. Java: 48)
The at org. Apache. Mina. Core. Filterchain. DefaultIoFilterChain $EntryImpl $1. FilterWrite (DefaultIoFilterChain. Java: 953)
The at org. Apache. Mina. Core. Filterchain. IoFilterAdapter. FilterWrite (IoFilterAdapter. Java: 123)
The at org. Apache. Mina. Core. Filterchain. DefaultIoFilterChain. CallPreviousFilterWrite (DefaultIoFilterChain. Java: 625)
At org. Apache. Mina. Core. Filterchain. DefaultIoFilterChain. Access the $1500 (DefaultIoFilterChain. Java: 48)
The at org. Apache. Mina. Core. Filterchain. DefaultIoFilterChain $EntryImpl $1. FilterWrite (DefaultIoFilterChain. Java: 953)
The at org. Apache. Mina. Filter. The codec. ProtocolCodecFilter $ProtocolEncoderOutputImpl. Flush (ProtocolCodecFilter. Java: 440)
Pray god give directions

CodePudding user response:

Don't see what, can only guess you try to manually close the connection? UDP does not need close the connection, it is a connectionless protocol itself, also do not need to close port,
After the program runs, the sender message directly (no need to worry about the message, also need not recycling), the receiver bind port (no need to worry about the message, don't have to shut down, need not unbundling, without recycling), and then to "send/receive" write code to go, don't need to do any other operations,
  • Related