Thread: Tcp and icmp Question

  1. #1
    Registered User invisibleghost's Avatar
    Join Date
    Jun 2004
    Posts
    28

    Tcp and icmp Question

    How would a tcp icmp look like?

  2. #2
    and the hat of int overfl Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    39,659
    Well to a length of cable, it looks like a series of electical voltage changes.
    To a NIC, it's probably just an array of bytes.
    If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
    If at first you don't succeed, try writing your phone number on the exam paper.

  3. #3
    S Sang-drax's Avatar
    Join Date
    May 2002
    Location
    Göteborg, Sweden
    Posts
    2,072
    Tcp and icmp are two different protocols.
    Last edited by Sang-drax : Tomorrow at 02:21 AM. Reason: Time travelling

  4. #4
    Registered User invisibleghost's Avatar
    Join Date
    Jun 2004
    Posts
    28
    Can you write own protocols in C?I am talking about the tcp and icmp headers.do i have to be root to do this on linux?
    Last edited by invisibleghost; 08-01-2005 at 12:16 PM.

  5. #5
    S Sang-drax's Avatar
    Join Date
    May 2002
    Location
    Göteborg, Sweden
    Posts
    2,072
    Yes. But if you want to write protocols in or below level 3 (network), it's operating system dependent. Otherwise, you can use sockets.
    Last edited by Sang-drax : Tomorrow at 02:21 AM. Reason: Time travelling

  6. #6
    Registered User invisibleghost's Avatar
    Join Date
    Jun 2004
    Posts
    28
    Could Make a tcp header but if i want to make my own tcp header i have to be in root.What you mean by socket's?I still a newbie at this.

  7. #7
    Registered User kryptkat's Avatar
    Join Date
    Dec 2002
    Posts
    638
    TCP Header Format





    TCP Header Format


    0 1 2 3
    0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
    | Source Port | Destination Port |
    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
    | Sequence Number |
    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
    | Acknowledgment Number |
    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
    | Data | |U|A|P|R|S|F| |
    | Offset| Reserved |R|C|S|S|Y|I| Window |
    | | |G|K|H|T|N|N| |
    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
    | Checksum | Urgent Pointer |
    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
    | Options | Padding |
    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
    | data |
    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+

  8. #8
    Registered User
    Join Date
    Apr 2005
    Posts
    134
    TCP and ICMP headers have standard structures. Do you mean creating your own TCP header for the packet. ? If yes, then you will have to use RAW sockets to do that. To use RAW sockets in your program you have to be a superuser (like root on *nix systems).

    Check this URL. It has good info on RAW sockets and how to construct TCP, UDP and ICMP headers.

    Thanks,

  9. #9
    Registered User invisibleghost's Avatar
    Join Date
    Jun 2004
    Posts
    28
    So i take it i can do some socket in usr on linux that if i am right?

  10. #10
    * Death to Visual Basic * Devil Panther's Avatar
    Join Date
    Aug 2001
    Posts
    768
    Quote Originally Posted by Sang-drax
    Yes. But if you want to write protocols in or below level 3 (network), it's operating system dependent. Otherwise, you can use sockets.
    What do you mean by OS dependent? How could one create layer 2 packets?
    "I don't suffer from insanity but enjoy every minute of it" - Edgar Allen Poe

    http://www.Bloodware.net - Developing free software for the community.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Obtaining source & destination IP,details of ICMP Header & each of field of it ???
    By cromologic in forum Networking/Device Communication
    Replies: 1
    Last Post: 04-29-2006, 02:49 PM
  2. Can TCP sockets also receive ICMP...?
    By failure_to in forum Networking/Device Communication
    Replies: 3
    Last Post: 06-09-2004, 10:36 AM
  3. Traceroute using UDP and ICMP
    By Unregistered in forum C++ Programming
    Replies: 1
    Last Post: 08-09-2002, 07:09 PM
  4. Traceroute using UDP + ICMP
    By Unregistered in forum Windows Programming
    Replies: 0
    Last Post: 08-05-2002, 10:50 AM