Send ACK message
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.
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.
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?
Well, ACK is a standard http message. It is just literally:
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.
Many protocols use the character value 0x06 for ACKnowledgement.
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?
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".
Originally Posted by daghenningsorbo
On the other hand, since an ACK will not have any further content, you could make it more elaborate to prevent confusion:
* the literal "ACK" is from http & the SYN-ACK "handshake" used by web servers.
#define ACK "<!Recieved!>"
Thank you for your answer. That cleared things up for me.