Thread: Send ACK message

  1. #1
    Registered User
    Join Date
    Dec 2006
    Posts
    19

    Send ACK message

    Hello.
    I have an assignment where I shall communicate with a server and send messages between client and server. The text says that when a message has been received, the server shall answer with an ACK. I really don't understand what an ACK means and how to send one. I have searched on google and some books but haven't found an answer. Can anyone help me out and point me in the right direction. We're using Berkley sockets and communicating through TCP on Linux.

    dagH

  2. #2
    Registered User C_ntua's Avatar
    Join Date
    Jun 2008
    Posts
    1,853
    TCP where you can find about ACK (acknwoledgement).

    I would think that all this stuff is done automatically for you. You call a function Send() and it waits until the message is sent. It retries until this happens. It is notified when it does, meaning no need to actually sent anything else (as a programmer).

    Except if you are using something really low-level and you need to do anything manually.

  3. #3
    Registered User
    Join Date
    Dec 2006
    Posts
    19
    Yes I have understood the meaning of ACK in a TCP packet, but in the assignment I'm gonna send a message from server, then when the message is received on the client, I'm gonna send an ACK back to the server to confirm that the message really was received. Does anyone know to do that?

  4. #4
    spurious conceit MK27's Avatar
    Join Date
    Jul 2008
    Location
    segmentation fault
    Posts
    8,300
    Well, ACK is a standard http message. It is just literally:
    Code:
    char ack_msg[]="ACK"
    Altho this includes a null terminator, which is not necessary except to the extent that it may make the handling in C easier.

    Of course, if you are doing all that you may also have to include a HTTP header with each message (presuming your server is supposed to operate in accord with the http protocols).

    Contrary to C_ntua's contention, ACK is not part of the TCP protocol. You obviously do not need to worry about the tcp/ip details if you are using a C socket networking API. The TCP/IP stuff is done for you yes -- but it does not do http negotiation, you have to code that yourself.
    Last edited by MK27; 11-07-2009 at 10:27 AM.
    C programming resources:
    GNU C Function and Macro Index -- glibc reference manual
    The C Book -- nice online learner guide
    Current ISO draft standard
    CCAN -- new CPAN like open source library repository
    3 (different) GNU debugger tutorials: #1 -- #2 -- #3
    cpwiki -- our wiki on sourceforge

  5. #5
    Registered User
    Join Date
    Aug 2005
    Location
    Austria
    Posts
    1,990
    Many protocols use the character value 0x06 for ACKnowledgement.
    Kurt

  6. #6
    Registered User
    Join Date
    Dec 2006
    Posts
    19
    Well, I'm not doing anything related to the http protocol. We are supposed to create our own application layer protocol to handle the messages. The messages sent from client to server is just raw text.

    I think what I'm really asking for is if ACK is a special message (with a specified format)? Of course I can make some formatting to my messages and then define an ACK-message, but that's all about what I do with the data being sent.

    So is ACK a special type of message with a defined format?

  7. #7
    spurious conceit MK27's Avatar
    Join Date
    Jul 2008
    Location
    segmentation fault
    Posts
    8,300
    Quote Originally Posted by daghenningsorbo View Post
    Well, I'm not doing anything related to the http protocol.

    So is ACK a special type of message with a defined format?
    In that case, "ACK" is just conceptual* (and the "concept" is pretty self-evident methinks -- you have pretty much explained it yourself). As Zuk points out, you could use anything as the actual signal. When I do client server stuff, I like to use single byte signals (255 is enough...), usually capital letters. So "A" could mean "acknowledged".

    On the other hand, since an ACK will not have any further content, you could make it more elaborate to prevent confusion:
    Code:
    #define ACK "<!Recieved!>"
    * the literal "ACK" is from http & the SYN-ACK "handshake" used by web servers.
    C programming resources:
    GNU C Function and Macro Index -- glibc reference manual
    The C Book -- nice online learner guide
    Current ISO draft standard
    CCAN -- new CPAN like open source library repository
    3 (different) GNU debugger tutorials: #1 -- #2 -- #3
    cpwiki -- our wiki on sourceforge

  8. #8
    Registered User
    Join Date
    Dec 2006
    Posts
    19
    Thank you for your answer. That cleared things up for me.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Desperate Over Ecs!
    By cookie in forum C Programming
    Replies: 17
    Last Post: 07-16-2008, 01:25 PM
  2. sending n no of char data uning send() function,
    By thebrighter in forum Windows Programming
    Replies: 1
    Last Post: 08-22-2007, 12:26 PM
  3. Message class ** Need help befor 12am tonight**
    By TransformedBG in forum C++ Programming
    Replies: 1
    Last Post: 11-29-2006, 11:03 PM
  4. Making a script language?
    By Blackroot in forum Game Programming
    Replies: 10
    Last Post: 02-16-2006, 02:22 AM
  5. Sending CChildView a Message :: MFC
    By kuphryn in forum Windows Programming
    Replies: 0
    Last Post: 04-06-2002, 03:00 PM

Tags for this Thread