Thread: Send data packet

  1. #1
    Registered User
    Join Date
    Mar 2015
    Posts
    22

    Send data packet

    Hello everyone
    I have few confusions as to how to send datapackets. When we send a data packet from device to another, say I have a "string". How Do I send it? Are data sent as a hex or binary number?If so do i first convert the "string" into hex or binary and then send it over the communication medium(say UART)??
    What is the underlying concept behind it?
    To elaborate my question, say I have two hex numbers to be sent using the UART, do i wrap it in some specific form and send it and retrieve it on the other side?Say if I have a data structure, in that case how do i send it?Thats a lot of question,sorry for that. But I am confused.
    If there is any reading material available please suggest. Sending data packets is very cruicial in an embedded system, so I want to really get to the basics .Thank you
    Last edited by amaturequestion; 03-30-2015 at 06:15 AM.

  2. #2
    and the hat of int overfl Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    39,665
    At the lowest level, it's all just bytes.

    Whether you send two bytes 0x55 and 0xAA, or a string of 4 characters "55AA" or a string of 6 characters "0x55AA" really doesn't matter.

    The only thing that matters is that BOTH ends agree on what is going to be sent, so that the communication is successful.
    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
    Registered User
    Join Date
    Mar 2015
    Posts
    22
    Thank u Salem

    I would dig more into the subject.Khudahavis

  4. #4
    and the hat of int overfl Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    39,665
    > Say if I have a data structure, in that case how do i send it?
    Lookup "data structure serialisation".
    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.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. HTTP Packet Genration and Send/Reciev Via C Socket
    By SimplySud in forum C Programming
    Replies: 4
    Last Post: 12-28-2014, 11:11 AM
  2. How to send a FIN with my last packet???
    By klipseracer in forum C++ Programming
    Replies: 1
    Last Post: 03-08-2008, 12:40 AM
  3. packet data
    By l2u in forum Networking/Device Communication
    Replies: 16
    Last Post: 01-22-2007, 11:46 AM
  4. Send()s being clumped into one packet
    By Yasir_Malik in forum Windows Programming
    Replies: 4
    Last Post: 05-03-2006, 09:58 PM
  5. Preparing packet to send
    By davide_82 in forum C Programming
    Replies: 3
    Last Post: 11-05-2005, 02:28 PM

Tags for this Thread