You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@mina.apache.org by dcsepely <dc...@infomatix.hu> on 2007/09/26 15:51:02 UTC

DatagramConnector - broadcast message sending problem

I've written a simple datagram broadcast sender application using Mina 1.1.2.
It works correctly but after ~1 minute the IoSession.write() always throws
an org.apache.mina.common.RuntimeIOException exception. There is exactly one
IoSession instance during the application lifecycle.

The full stacktrace is shown bellow:

org.apache.mina.common.RuntimeIOException: java.net.SocketException: Socket
operation on nonsocket: sun.nio.ch.Net.setIntOption
	at
org.apache.mina.transport.socket.nio.support.DatagramSessionImpl$SessionConfigImpl.isBroadcast(DatagramSessionImpl.java:262)
	at
org.apache.mina.transport.socket.nio.support.DatagramSessionImpl.write(DatagramSessionImpl.java:163)
	at
org.apache.mina.common.support.BaseIoSession.write(BaseIoSession.java:136)
	at
hu.infomatix.mango.ox.daemon.mail.test.DatagramBroadcastSender.main(DatagramBroadcastSender.java:65)
Caused by: java.net.SocketException: Socket operation on nonsocket:
sun.nio.ch.Net.setIntOption
	at sun.nio.ch.Net.getIntOption0(Native Method)
	at sun.nio.ch.Net.getIntOption(Unknown Source)
	at sun.nio.ch.DatagramChannelImpl$1.getInt(Unknown Source)
	at sun.nio.ch.SocketOptsImpl.getBoolean(Unknown Source)
	at sun.nio.ch.SocketOptsImpl.broadcast(Unknown Source)
	at sun.nio.ch.OptionAdaptor.getBroadcast(Unknown Source)
	at sun.nio.ch.DatagramSocketAdaptor.getBroadcast(Unknown Source)
	at
org.apache.mina.transport.socket.nio.support.DatagramSessionImpl$SessionConfigImpl.isBroadcast(DatagramSessionImpl.java:260)
	... 3 more

How could i get rid of this error?

Thanks in advance for your answers.
-- 
View this message in context: http://www.nabble.com/DatagramConnector---broadcast-message-sending-problem-tf4522509s16868.html#a12901404
Sent from the Apache MINA Support Forum mailing list archive at Nabble.com.


Re: DatagramConnector - broadcast message sending problem

Posted by Trustin Lee <tr...@gmail.com>.
On 9/29/07, dcsepely <dc...@infomatix.hu> wrote:
>
> Thank you for your answer! I'll try it out.

You could try the snapshot distribution here:

http://people.apache.org/~trustin/snapshot/

HTH,
Trustin
-- 
what we call human nature is actually human habit
--
http://gleamynode.net/
--
PGP Key ID: 0x0255ECA6

Re: DatagramConnector - broadcast message sending problem

Posted by dcsepely <dc...@infomatix.hu>.
Thank you for your answer! I'll try it out.


Trustin Lee wrote:
> 
> On 9/26/07, dcsepely <dc...@infomatix.hu> wrote:
>>
>> I'm using Windows Vista & Windows XP. I attached a sample application it
>> also
>> throws an org.apache.mina.common.RuntimeIOException after one minute.
> 
> I don't know what such an exception is thrown, but I also found the
> same problem in a certain Linux distribution.  I've just got rid of
> the call because there's no point in calling isBroadcast().  It should
> work fine now.
> 
> The fix will be released in the next released.
> 
> Thanks,
> Trustin
> -- 
> what we call human nature is actually human habit
> --
> http://gleamynode.net/
> --
> PGP Key ID: 0x0255ECA6
> 
> 

-- 
View this message in context: http://www.nabble.com/DatagramConnector---broadcast-message-sending-problem-tf4522509s16868.html#a12945598
Sent from the Apache MINA Support Forum mailing list archive at Nabble.com.


Re: DatagramConnector - broadcast message sending problem

Posted by Trustin Lee <tr...@gmail.com>.
On 9/26/07, dcsepely <dc...@infomatix.hu> wrote:
>
> I'm using Windows Vista & Windows XP. I attached a sample application it also
> throws an org.apache.mina.common.RuntimeIOException after one minute.

I don't know what such an exception is thrown, but I also found the
same problem in a certain Linux distribution.  I've just got rid of
the call because there's no point in calling isBroadcast().  It should
work fine now.

The fix will be released in the next released.

Thanks,
Trustin
-- 
what we call human nature is actually human habit
--
http://gleamynode.net/
--
PGP Key ID: 0x0255ECA6

Re: DatagramConnector - broadcast message sending problem

Posted by dcsepely <dc...@infomatix.hu>.
I'm using Windows Vista & Windows XP. I attached a sample application it also
throws an org.apache.mina.common.RuntimeIOException after one minute.


Trustin Lee wrote:
> 
> Hi DCSReply,
> 
> On 9/26/07, dcsepely <dc...@infomatix.hu> wrote:
>>
>> I've written a simple datagram broadcast sender application using Mina
>> 1.1.2.
>> It works correctly but after ~1 minute the IoSession.write() always
>> throws
>> an org.apache.mina.common.RuntimeIOException exception. There is exactly
>> one
>> IoSession instance during the application lifecycle.
>>
>> The full stacktrace is shown bellow:
>>
>> org.apache.mina.common.RuntimeIOException: java.net.SocketException:
>> Socket
>> operation on nonsocket: sun.nio.ch.Net.setIntOption
>>         at
>> org.apache.mina.transport.socket.nio.support.DatagramSessionImpl$SessionConfigImpl.isBroadcast(DatagramSessionImpl.java:262)
>>         at
>> org.apache.mina.transport.socket.nio.support.DatagramSessionImpl.write(DatagramSessionImpl.java:163)
>>         at
>> org.apache.mina.common.support.BaseIoSession.write(BaseIoSession.java:136)
>>         at
>> hu.infomatix.mango.ox.daemon.mail.test.DatagramBroadcastSender.main(DatagramBroadcastSender.java:65)
>> Caused by: java.net.SocketException: Socket operation on nonsocket:
>> sun.nio.ch.Net.setIntOption
>>         at sun.nio.ch.Net.getIntOption0(Native Method)
>>         at sun.nio.ch.Net.getIntOption(Unknown Source)
>>         at sun.nio.ch.DatagramChannelImpl$1.getInt(Unknown Source)
>>         at sun.nio.ch.SocketOptsImpl.getBoolean(Unknown Source)
>>         at sun.nio.ch.SocketOptsImpl.broadcast(Unknown Source)
>>         at sun.nio.ch.OptionAdaptor.getBroadcast(Unknown Source)
>>         at sun.nio.ch.DatagramSocketAdaptor.getBroadcast(Unknown Source)
>>         at
>> org.apache.mina.transport.socket.nio.support.DatagramSessionImpl$SessionConfigImpl.isBroadcast(DatagramSessionImpl.java:260)
>>         ... 3 more
>>
>> How could i get rid of this error?
>>
>> Thanks in advance for your answers.
> 
> What operating system do you use?  On what address did you bind?  In
> most operating systems, you have to bind on 0.0.0.0 like the
> following:
> 
> acceptor.bind(new InetSocketAddress(8080), ...);
> 
> Trustin
> -- 
> what we call human nature is actually human habit
> --
> http://gleamynode.net/
> --
> PGP Key ID: 0x0255ECA6
> 
> 
http://www.nabble.com/file/p12905376/SampleDatagaramBroadcastSender.java
SampleDatagaramBroadcastSender.java 
http://www.nabble.com/file/p12905376/SampleDatagaramBroadcastSender.java
SampleDatagaramBroadcastSender.java 
-- 
View this message in context: http://www.nabble.com/DatagramConnector---broadcast-message-sending-problem-tf4522509s16868.html#a12905376
Sent from the Apache MINA Support Forum mailing list archive at Nabble.com.


Re: DatagramConnector - broadcast message sending problem

Posted by Trustin Lee <tr...@gmail.com>.
Hi DCSReply,

On 9/26/07, dcsepely <dc...@infomatix.hu> wrote:
>
> I've written a simple datagram broadcast sender application using Mina 1.1.2.
> It works correctly but after ~1 minute the IoSession.write() always throws
> an org.apache.mina.common.RuntimeIOException exception. There is exactly one
> IoSession instance during the application lifecycle.
>
> The full stacktrace is shown bellow:
>
> org.apache.mina.common.RuntimeIOException: java.net.SocketException: Socket
> operation on nonsocket: sun.nio.ch.Net.setIntOption
>         at
> org.apache.mina.transport.socket.nio.support.DatagramSessionImpl$SessionConfigImpl.isBroadcast(DatagramSessionImpl.java:262)
>         at
> org.apache.mina.transport.socket.nio.support.DatagramSessionImpl.write(DatagramSessionImpl.java:163)
>         at
> org.apache.mina.common.support.BaseIoSession.write(BaseIoSession.java:136)
>         at
> hu.infomatix.mango.ox.daemon.mail.test.DatagramBroadcastSender.main(DatagramBroadcastSender.java:65)
> Caused by: java.net.SocketException: Socket operation on nonsocket:
> sun.nio.ch.Net.setIntOption
>         at sun.nio.ch.Net.getIntOption0(Native Method)
>         at sun.nio.ch.Net.getIntOption(Unknown Source)
>         at sun.nio.ch.DatagramChannelImpl$1.getInt(Unknown Source)
>         at sun.nio.ch.SocketOptsImpl.getBoolean(Unknown Source)
>         at sun.nio.ch.SocketOptsImpl.broadcast(Unknown Source)
>         at sun.nio.ch.OptionAdaptor.getBroadcast(Unknown Source)
>         at sun.nio.ch.DatagramSocketAdaptor.getBroadcast(Unknown Source)
>         at
> org.apache.mina.transport.socket.nio.support.DatagramSessionImpl$SessionConfigImpl.isBroadcast(DatagramSessionImpl.java:260)
>         ... 3 more
>
> How could i get rid of this error?
>
> Thanks in advance for your answers.

What operating system do you use?  On what address did you bind?  In
most operating systems, you have to bind on 0.0.0.0 like the
following:

acceptor.bind(new InetSocketAddress(8080), ...);

Trustin
-- 
what we call human nature is actually human habit
--
http://gleamynode.net/
--
PGP Key ID: 0x0255ECA6