带有带外数据的Java套接字 [英] Java sockets with out of band data

查看:183
本文介绍了带有带外数据的Java套接字的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有人知道如何使用Java套接字接收(如何知道您收到的)带外数据?特别是我已经阅读了 sendUrgentData setOOBInline 表明:


注意,仅提供有限的支持来处理传入的紧急数据。特别是,没有提供传入紧急数据的通知,除非由更高级别的协议提供,否则无法区分正常数据和紧急数据。


但我仍然希望有人有解决方案: - )



更多详情:



<我正在通过套接字发送序列化对象,我真的没有看到如何在流中找到一个随机的OOB字节(除了Java在我试图尝试时会给我一个例外的事实反序列化对象)。

解决方案

Tomcat有一个JNI套接字的维护实现,它可以以OOB方式读取紧急数据包。


Does anybody know how to receive (how to know that you received) out-of-band data with Java sockets? In particular I've read the documentation for sendUrgentData and setOOBInline which states that:

Note, only limited support is provided for handling incoming urgent data. In particular, no notification of incoming urgent data is provided and there is no capability to distinguish between normal data and urgent data unless provided by a higher level protocol.

But I'm still hoping that somebody has a solution :-)

More details:

I'm sending serialized objects trough the socket and I'm not really seeing how I can find a "random" OOB byte inserted in the stream (other than the fact that Java will give me an exception when I'll try to deserialize the object).

解决方案

Tomcat has a maintained implementation of JNI socket which can read urgent packets in a OOB manner.

这篇关于带有带外数据的Java套接字的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆