You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@mina.apache.org by minatds <na...@gmail.com> on 2007/08/07 18:15:41 UTC

How to send a urgent data packet

Hi All,
I am using a modified version of proxy server example to capture the traffic
between
some old version of powerbuilder apps and TDS protocol complaint server.

I get urgent data packet from my application and after setting OOBInline, I
can see that packet,
but when I transmit to my  remote destination, I need to send it as Urgent
data packet.
there is an option on socket API to do this like sendUrgentData.

Can some one please suggest me how to do the same in Mina.

eagerly waiting for your reply

thanks
Sincerely
MinaTDS

-- 
View this message in context: http://www.nabble.com/How-to-send-a-urgent-data-packet-tf4231150s16868.html#a12037462
Sent from the Apache MINA Support Forum mailing list archive at Nabble.com.


Re: Help Needed - Exception - Urgent data not supported - Any Work Around????

Posted by minatds <na...@gmail.com>.
I think that works for me.

Only caveat is that  urgent data packets  usually are 1 byte in size (even
the socket's sendurgentdata takes int as parameter). 

I think it would be better if it stays on its own as a special so that
people don't misuse this HIGHEST priority. 
Moreover every server hates to receive urgent data packets as they can be
potential to DOS attacks.

WDYT?

Hope this helps
thanks
Sincerely
minatds


mheath wrote:
> 
> Perhaps this could be solved in conjunction with 
> https://issues.apache.org/jira/browse/DIRMINA-428.  With UDP, if the 
> priority is above a certain threshold we would send the packet as an 
> urgent data packet.
> 
> WDYT?
> 
> -Mike
> 
> minatds wrote:
>> You are correct about the fact that few routers support them and also
>> many
>> avoid to use urgent data packets
>> as they can be a cause for DOS attacks.  In my situation, my application
>> act
>> as a gateway/router where it interacts with  the legacy applications
>> built
>> in Powerbuilder and Sybase/TDS complaint Mainframe applications.
>> The power builder application waits after sending  urgent packet and the
>> server has to respond for that packet to continue.
>> So any help to get this patch, will be of great help.
>> Other than this, MINA rocks. 
>> 
>> thanks a lot
>> Sincerely
>> Minatds
>> 
>> Adam Fisk-3 wrote:
>>> I'm curious if you see any effect of the urgent data options.  My
>>> understanding was that few routers support them.  Do you see them having
>>> an
>>> effect?
>>>
>>> I'd suggest just a patch to the configuration classes to support the
>>> option.  Should be a really easy change, and I'd suspect it would be
>>> accepted quickly.  I think the change you'd want to make would be in
>>> SocketSessionConfigImpl.
>>>
>>> Not ideal, I realize, but I'd expect that change to get accepted really
>>> quickly if you submit a patch, and you could run off the mainline until
>>> the
>>> release.
>>>
>>> -Adam
>>>
>>>
>>> On 8/28/07, minatds <na...@gmail.com> wrote:
>>>>
>>>> Trustin,
>>>>
>>>> I am wondering whether there is any work around for sending urgent data
>>>> packet?
>>>>
>>>> thanks
>>>> sincerely
>>>> minatds
>>>>
>>>>
>>>> minatds wrote:
>>>>> Thanks Jeroen.
>>>>> As I have mentioned in the earlier mails, I have enabled setOOBInline
>>>> in
>>>>> my code and only after that I could detect urgent data packets.
>>>>> Now I have to SEND the urgent data packets and that seems to be the
>>>>> problem.
>>>>>
>>>>>
>>>>>
>>>>>
>>>> --
>>>> View this message in context:
>>>> http://www.nabble.com/How-to-send-a-urgent-data-packet-tf4231150s16868.html#a12377736
>>>> Sent from the Apache MINA Support Forum mailing list archive at
>>>> Nabble.com
>>>> .
>>>>
>>>>
>>>
>> 
> 
> 
> 

-- 
View this message in context: http://www.nabble.com/How-to-send-a-urgent-data-packet-tf4231150s16868.html#a12412610
Sent from the Apache MINA Support Forum mailing list archive at Nabble.com.


Re: Help Needed - Exception - Urgent data not supported - Any Work Around????

Posted by Mike Heath <mh...@apache.org>.
Perhaps this could be solved in conjunction with 
https://issues.apache.org/jira/browse/DIRMINA-428.  With UDP, if the 
priority is above a certain threshold we would send the packet as an 
urgent data packet.

WDYT?

-Mike

minatds wrote:
> You are correct about the fact that few routers support them and also many
> avoid to use urgent data packets
> as they can be a cause for DOS attacks.  In my situation, my application act
> as a gateway/router where it interacts with  the legacy applications built
> in Powerbuilder and Sybase/TDS complaint Mainframe applications.
> The power builder application waits after sending  urgent packet and the
> server has to respond for that packet to continue.
> So any help to get this patch, will be of great help.
> Other than this, MINA rocks. 
> 
> thanks a lot
> Sincerely
> Minatds
> 
> Adam Fisk-3 wrote:
>> I'm curious if you see any effect of the urgent data options.  My
>> understanding was that few routers support them.  Do you see them having
>> an
>> effect?
>>
>> I'd suggest just a patch to the configuration classes to support the
>> option.  Should be a really easy change, and I'd suspect it would be
>> accepted quickly.  I think the change you'd want to make would be in
>> SocketSessionConfigImpl.
>>
>> Not ideal, I realize, but I'd expect that change to get accepted really
>> quickly if you submit a patch, and you could run off the mainline until
>> the
>> release.
>>
>> -Adam
>>
>>
>> On 8/28/07, minatds <na...@gmail.com> wrote:
>>>
>>> Trustin,
>>>
>>> I am wondering whether there is any work around for sending urgent data
>>> packet?
>>>
>>> thanks
>>> sincerely
>>> minatds
>>>
>>>
>>> minatds wrote:
>>>> Thanks Jeroen.
>>>> As I have mentioned in the earlier mails, I have enabled setOOBInline
>>> in
>>>> my code and only after that I could detect urgent data packets.
>>>> Now I have to SEND the urgent data packets and that seems to be the
>>>> problem.
>>>>
>>>>
>>>>
>>>>
>>> --
>>> View this message in context:
>>> http://www.nabble.com/How-to-send-a-urgent-data-packet-tf4231150s16868.html#a12377736
>>> Sent from the Apache MINA Support Forum mailing list archive at
>>> Nabble.com
>>> .
>>>
>>>
>>
> 


Re: Help Needed - Exception - Urgent data not supported - Any Work Around????

Posted by minatds <na...@gmail.com>.
You are correct about the fact that few routers support them and also many
avoid to use urgent data packets
as they can be a cause for DOS attacks.  In my situation, my application act
as a gateway/router where it interacts with  the legacy applications built
in Powerbuilder and Sybase/TDS complaint Mainframe applications.
The power builder application waits after sending  urgent packet and the
server has to respond for that packet to continue.
So any help to get this patch, will be of great help.
Other than this, MINA rocks. 

thanks a lot
Sincerely
Minatds

Adam Fisk-3 wrote:
> 
> I'm curious if you see any effect of the urgent data options.  My
> understanding was that few routers support them.  Do you see them having
> an
> effect?
> 
> I'd suggest just a patch to the configuration classes to support the
> option.  Should be a really easy change, and I'd suspect it would be
> accepted quickly.  I think the change you'd want to make would be in
> SocketSessionConfigImpl.
> 
> Not ideal, I realize, but I'd expect that change to get accepted really
> quickly if you submit a patch, and you could run off the mainline until
> the
> release.
> 
> -Adam
> 
> 
> On 8/28/07, minatds <na...@gmail.com> wrote:
>>
>>
>> Trustin,
>>
>> I am wondering whether there is any work around for sending urgent data
>> packet?
>>
>> thanks
>> sincerely
>> minatds
>>
>>
>> minatds wrote:
>> >
>> > Thanks Jeroen.
>> > As I have mentioned in the earlier mails, I have enabled setOOBInline
>> in
>> > my code and only after that I could detect urgent data packets.
>> > Now I have to SEND the urgent data packets and that seems to be the
>> > problem.
>> >
>> >
>> >
>> >
>>
>> --
>> View this message in context:
>> http://www.nabble.com/How-to-send-a-urgent-data-packet-tf4231150s16868.html#a12377736
>> Sent from the Apache MINA Support Forum mailing list archive at
>> Nabble.com
>> .
>>
>>
> 
> 

-- 
View this message in context: http://www.nabble.com/How-to-send-a-urgent-data-packet-tf4231150s16868.html#a12397223
Sent from the Apache MINA Support Forum mailing list archive at Nabble.com.


Re: Help Needed - Exception - Urgent data not supported - Any Work Around????

Posted by Adam Fisk <a...@lastbamboo.org>.
I'm curious if you see any effect of the urgent data options.  My
understanding was that few routers support them.  Do you see them having an
effect?

I'd suggest just a patch to the configuration classes to support the
option.  Should be a really easy change, and I'd suspect it would be
accepted quickly.  I think the change you'd want to make would be in
SocketSessionConfigImpl.

Not ideal, I realize, but I'd expect that change to get accepted really
quickly if you submit a patch, and you could run off the mainline until the
release.

-Adam


On 8/28/07, minatds <na...@gmail.com> wrote:
>
>
> Trustin,
>
> I am wondering whether there is any work around for sending urgent data
> packet?
>
> thanks
> sincerely
> minatds
>
>
> minatds wrote:
> >
> > Thanks Jeroen.
> > As I have mentioned in the earlier mails, I have enabled setOOBInline in
> > my code and only after that I could detect urgent data packets.
> > Now I have to SEND the urgent data packets and that seems to be the
> > problem.
> >
> >
> >
> >
>
> --
> View this message in context:
> http://www.nabble.com/How-to-send-a-urgent-data-packet-tf4231150s16868.html#a12377736
> Sent from the Apache MINA Support Forum mailing list archive at Nabble.com
> .
>
>

Re: Help Needed - Exception - Urgent data not supported - Any Work Around????

Posted by minatds <na...@gmail.com>.
Trustin,

I am wondering whether there is any work around for sending urgent data
packet?

thanks
sincerely
minatds


minatds wrote:
> 
> Thanks Jeroen.
> As I have mentioned in the earlier mails, I have enabled setOOBInline in
> my code and only after that I could detect urgent data packets.
> Now I have to SEND the urgent data packets and that seems to be the
> problem.
> 
> 
> 
> 

-- 
View this message in context: http://www.nabble.com/How-to-send-a-urgent-data-packet-tf4231150s16868.html#a12377736
Sent from the Apache MINA Support Forum mailing list archive at Nabble.com.


Re: Help Needed - Exception - Urgent data not supported

Posted by minatds <na...@gmail.com>.
Thanks Jeroen.
As I have mentioned in the earlier mails, I have enabled setOOBInline in my
code and only after that I could detect urgent data packets.
Now I have to SEND the urgent data packets and that seems to be the problem.



-- 
View this message in context: http://www.nabble.com/How-to-send-a-urgent-data-packet-tf4231150s16868.html#a12075662
Sent from the Apache MINA Support Forum mailing list archive at Nabble.com.


Re: Help Needed - Exception - Urgent data not supported

Posted by Jeroen Brattinga <je...@gmail.com>.
Hmmm... I'm no expert on this subject, but did find this: 
http://java.sun.com/j2se/1.5.0/docs/api/java/net/Socket.html#setOOBInline(boolean)

Maybe that could help you?


Jeroen Brattinga


minatds wrote:
> Hi all,
> I tried to do a quick fix/hack.
> I have made SocketSessionImpl as public and used it in my
> AbstractProxyIOHandler (Proxy example) message received method. Below is the
> code snippet.
> I get Urgent data not supported exception.
> I am totally lost now - any ideas on how to create a fix for this.
>
> thanks a lot
> Sincerely
> minatds
>
>
> here is the code snippet:
>
> public void messageReceived(IoSession session, Object message)
>             throws Exception {
>         ByteBuffer rb = (ByteBuffer) message;
>               ByteBuffer wb = ByteBuffer.allocate(rb.remaining());
>         rb.mark();
>         wb.put(rb);
>         
>         wb.flip();
>         ((IoSession) session.getAttachment()).write(wb);
>         rb.reset();
>         if(rb.getString(CHARSET.newDecoder()).trim().equals("A"))
> 		{
> 			SessionLog.info(session,"##########We have got a Urgent Packet
> #########");
> 			((SocketSessionImpl)session).getCh().socket().sendUrgentData(1);
> 		}
>         SessionLog.info(session,rb.getString(CHARSET.newDecoder()));
>     }
>
>
>
> ClientToProxyIoHandler  - [/127.0.0.1:3530] EXCEPTION, please implement
> ClientToProxyIoHandler.exceptionCaught() for proper handling:
> java.net.SocketException: Urgent data not supported
> 	at sun.nio.ch.SocketAdaptor.sendUrgentData(Unknown Source)
> 	at AbstractProxyIoHandler.messageReceived(AbstractProxyIoHandler.java:69)
> 	at
> org.apache.mina.common.support.AbstractIoFilterChain$TailFilter.messageReceived(AbstractIoFilterChain.java:569)
> 	at
> org.apache.mina.common.support.AbstractIoFilterChain.callNextMessageReceived(AbstractIoFilterChain.java:299)
> 	at
> org.apache.mina.common.support.AbstractIoFilterChain.access$5(AbstractIoFilterChain.java:296)
> 	at
> org.apache.mina.common.support.AbstractIoFilterChain$EntryImpl$1.messageReceived(AbstractIoFilterChain.java:647)
> 	at
> org.apache.mina.filter.executor.ExecutorFilter.processEvent(ExecutorFilter.java:220)
> 	at
> org.apache.mina.filter.executor.ExecutorFilter$ProcessEventsRunnable.run(ExecutorFilter.java:265)
> 	at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(Unknown Source)
> 	at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
> 	at java.lang.Thread.run(Unknown Source)
>   

Re: Help Needed - Exception - Urgent data not supported

Posted by minatds <na...@gmail.com>.
Hi all,
I tried to do a quick fix/hack.
I have made SocketSessionImpl as public and used it in my
AbstractProxyIOHandler (Proxy example) message received method. Below is the
code snippet.
I get Urgent data not supported exception.
I am totally lost now - any ideas on how to create a fix for this.

thanks a lot
Sincerely
minatds


here is the code snippet:

public void messageReceived(IoSession session, Object message)
            throws Exception {
        ByteBuffer rb = (ByteBuffer) message;
              ByteBuffer wb = ByteBuffer.allocate(rb.remaining());
        rb.mark();
        wb.put(rb);
        
        wb.flip();
        ((IoSession) session.getAttachment()).write(wb);
        rb.reset();
        if(rb.getString(CHARSET.newDecoder()).trim().equals("A"))
		{
			SessionLog.info(session,"##########We have got a Urgent Packet
#########");
			((SocketSessionImpl)session).getCh().socket().sendUrgentData(1);
		}
        SessionLog.info(session,rb.getString(CHARSET.newDecoder()));
    }



ClientToProxyIoHandler  - [/127.0.0.1:3530] EXCEPTION, please implement
ClientToProxyIoHandler.exceptionCaught() for proper handling:
java.net.SocketException: Urgent data not supported
	at sun.nio.ch.SocketAdaptor.sendUrgentData(Unknown Source)
	at AbstractProxyIoHandler.messageReceived(AbstractProxyIoHandler.java:69)
	at
org.apache.mina.common.support.AbstractIoFilterChain$TailFilter.messageReceived(AbstractIoFilterChain.java:569)
	at
org.apache.mina.common.support.AbstractIoFilterChain.callNextMessageReceived(AbstractIoFilterChain.java:299)
	at
org.apache.mina.common.support.AbstractIoFilterChain.access$5(AbstractIoFilterChain.java:296)
	at
org.apache.mina.common.support.AbstractIoFilterChain$EntryImpl$1.messageReceived(AbstractIoFilterChain.java:647)
	at
org.apache.mina.filter.executor.ExecutorFilter.processEvent(ExecutorFilter.java:220)
	at
org.apache.mina.filter.executor.ExecutorFilter$ProcessEventsRunnable.run(ExecutorFilter.java:265)
	at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(Unknown Source)
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
	at java.lang.Thread.run(Unknown Source)
-- 
View this message in context: http://www.nabble.com/How-to-send-a-urgent-data-packet-tf4231150s16868.html#a12075208
Sent from the Apache MINA Support Forum mailing list archive at Nabble.com.


Re: How to send a urgent data packet

Posted by minatds <na...@gmail.com>.
I will also look into MINA code to see where I should add the patch.
My guess is adding a new method in IOSession along with write
session.sendurgentdata(long)

Meanwhile, if you guys have some more ideas or if you think it is more
complicated than that
please let me know

thanks
Sincerely
minatds

minatds wrote:
> 
> Sure. I will create JIRA issue.
> Do you know the timeline for MINA 2.0 release?
> I need to get my server go production by Sept 30, 2007.
> Can you  please suggest me where the changes should be
> so that I can build the code and add the patch.
> 
> thanks
> Sincerely
> Minatds
> 
> 
> 

-- 
View this message in context: http://www.nabble.com/How-to-send-a-urgent-data-packet-tf4231150s16868.html#a12066148
Sent from the Apache MINA Support Forum mailing list archive at Nabble.com.


Re: How to send a urgent data packet

Posted by minatds <na...@gmail.com>.
Sure. I will create JIRA issue.
Do you know the timeline for MINA 2.0 release?
I need to get my server go production by Sept 30, 2007.
Can you  please suggest me where the changes should be
so that I can build the code and add the patch.

thanks
Sincerely
Minatds


-- 
View this message in context: http://www.nabble.com/How-to-send-a-urgent-data-packet-tf4231150s16868.html#a12054618
Sent from the Apache MINA Support Forum mailing list archive at Nabble.com.


Re: How to send a urgent data packet

Posted by Trustin Lee <tr...@gmail.com>.
On 8/8/07, minatds <na...@gmail.com> wrote:
>
> Hi All,
> I am using a modified version of proxy server example to capture the traffic
> between
> some old version of powerbuilder apps and TDS protocol complaint server.
>
> I get urgent data packet from my application and after setting OOBInline, I
> can see that packet,
> but when I transmit to my  remote destination, I need to send it as Urgent
> data packet.
> there is an option on socket API to do this like sendUrgentData.
>
> Can some one please suggest me how to do the same in Mina.
>
> eagerly waiting for your reply

MINA currently doesn't support sendUrgentData operation yet.  I think
we can add it in MINA 2.0, the next major feature release.  Could you
file a JIRA issue?

http://issues.apache.org/jira/browse/DIRMINA

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