Click here to Skip to main content
15,891,431 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
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-

MSIL
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]




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
Posted

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.
 
Share this answer
 
Wow this was crazy. I finally figured out that the server was not setup to connect properly.

THANKS MOTOROLA.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900