用Java读写TCP头(选项) [英] Reading and writing TCP header (options) in Java

查看:676
本文介绍了用Java读写TCP头(选项)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想要做的是:
编写客户端和服务器以通过TCP与Java发送字符串,到目前为止使用Socket和Input- / Output-Stream没有问题。



但是现在我试图在tcp头的Options字段中添加3个数字。我找不到任何有用的教程或关于如何自定义标题以及如何阅读它的其他内容。



有什么建议吗?

解决方案

您不能: li>在应用程序级别,您无权访问TCP标头;

  • Java没有原始套接字。



  • 尽管如此,通过设置不同的套接字选项,您可以稍微影响TCP行为的某些行为。但不能直接操作TCP标头。


    What I'm trying to do is: Writing client and server for sending a String via TCP with Java, so far no problem using Socket and Input-/Output-Streams.

    But now I'm trying to add 3 numbers to the "Options" field in the tcp header . I can't find any helpful tutorials or something else on how to customize the header and how to read it.

    Any suggestions?

    解决方案

    You can't:

    • at application level, you do not have access to the TCP headers;
    • Java does not have raw sockets either.

    You can somewhat influence some of the TCP behavior by setting different socket options, though. But not manipulating TCP headers directly.

    这篇关于用Java读写TCP头(选项)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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