Click here to Skip to main content
Rate this: bad
good
Please Sign up or sign in to vote.
See more: C# Linux socket Network
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]
 

 
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 16-Jul-10 16:50pm
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 1

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.
  Permalink  
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 2

Wow this was crazy. I finally figured out that the server was not setup to connect properly.
 
THANKS MOTOROLA.
  Permalink  

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

  Print Answers RSS
0 OriginalGriff 277
1 Maciej Los 210
2 BillWoodruff 205
3 Jochen Arndt 180
4 Sergey Alexandrovich Kryukov 165
0 OriginalGriff 5,130
1 DamithSL 4,157
2 Maciej Los 3,650
3 Kornfeld Eliyahu Peter 3,460
4 Sergey Alexandrovich Kryukov 2,811


Advertise | Privacy | Mobile
Web01 | 2.8.141216.1 | Last Updated 17 Feb 2011
Copyright © CodeProject, 1999-2014
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100