套接字编程.net时间戳选项 [英] Socket programming .net timestamp options

查看:98
本文介绍了套接字编程.net时间戳选项的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在用C#编写套接字应用程序以与Unix设备通信.我正在使用TCP/IP,我的程序如下所示.以下只是整个代码的片段..

socket = new Socket(AddressFamily.InterNetwork,SocketType.Stream,ProtocolType.Tcp);
socket.Connect(Configuration.headend1.remoteIP);
socket.Send(packet_complete);
socket.Close();

我可以使用wireshark/ethereal网络分析器获得unix设备期望的以字节为单位的1个命令的示例.我使用wireshark发现unix设备期望以下时间戳(或者我认为这是一个时间戳)传输协议级别的选项.如果我在传输协议"级别标题下浏览鲨鱼",我会在选项(时间戳:TSval 18139934,TSecr 533285028和NOP)下看到一个新事物,如下所示-

I am writing a socket application in c# to talk to a unix device. I am using TCP/IP and my program looks something like the below. The below is just snippets from the whole code..

socket = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp);
socket.Connect(Configuration.headend1.remoteIP);
socket.Send(packet_complete);
socket.Close();

I was able to get an example of 1 command in bytes,using wireshark/ethereal network analyzer, that the unix device is expecting.I found out using wireshark that the unix device is expecting a timestamp(or i think it is a timestap) under the Transmission protrocol level options. If I look under wire shark under the Transmission protocol level heading I see a new thing under options(Timestamps: TSval 18139934, TSecr 533285028 and NOP) as show below-

Transmission Control Protocol, Src Port: 15100 (15100), Dst Port: 33526 (33526), Seq: 1, Ack: 17, Len: 0
    Source port: 15100 (15100)
    Destination port: 33526 (33526)
    [Stream index: 3]
    Sequence number: 1    (relative sequence number)
    Acknowledgement number: 17    (relative ack number)
    Header length: 44 bytes
    Flags: 0x10 (ACK)
        0... .... = Congestion Window Reduced (CWR): Not set
        .0.. .... = ECN-Echo: Not set
        ..0. .... = Urgent: Not set
        ...1 .... = Acknowledgement: Set
        .... 0... = Push: Not set
        .... .0.. = Reset: Not set
        .... ..0. = Syn: Not set
        .... ...0 = Fin: Not set
    Window size: 66560 (scaled)
    Checksum: 0x45eb [validation disabled]
        [Good Checksum: False]
        [Bad Checksum: False]
   <code> Options: (24 bytes)
        NOP
        NOP
        Timestamps: TSval 18139934, TSecr 533285028
        NOP
        NOP
        SACK: 1-17
            left edge = 1 (relative)
            right edge = 17 (relative)</code>    [SEQ/ACK analysis]
        [This is an ACK to the segment in frame: 25]
        [The RTT to ACK the segment was: 0.201174000 seconds]





问题是,当我使用套接字编程发送代码时,在wireshark中看不到时间戳或选项字段.所有12个字节均丢失.我该如何添加呢?我知道有socketoptions()函数,但我不知道如何使用它.任何帮助将不胜感激.
感谢





The problem is that when I send out my code using socket programming, I dont see the time stamp or options field in wireshark. All 12 bytes are missing. How do i add this? I know there are socketoptions() function but I dont know how to use it. Any help will be appreciated.
Thanks

推荐答案

您捕获的内容看起来像TCP/IP协议交换,该交换由双方的基础系统软件管理.套接字级别的消息交换与此数据无关.您应该同意客户机和UNIX系统之间的协议交换,并根据该协议发送适当的消息.
What you have captured looks like TCP/IP protocol exchange which is managed by the underlying system software on both sides. The message exchange at the socket level has nothing to do with this data. You should agree the protocol exchange between your client and the UNIX system and send messages as appropriate to that protocol.


哇,这太疯狂了.我终于发现服务器未正确连接.

谢谢摩托罗拉.
Wow this was crazy. I finally figured out that the server was not setup to connect properly.

THANKS MOTOROLA.


这篇关于套接字编程.net时间戳选项的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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