C Board  

Go Back   C Board > General Programming Boards > C Programming

Reply
 
LinkBack Thread Tools Display Modes
Old 11-07-2009, 06:28 AM   #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
daghenningsorbo is offline   Reply With Quote
Old 11-07-2009, 06:50 AM   #2
Registered User
 
C_ntua's Avatar
 
Join Date: Jun 2008
Posts: 1,134
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.
C_ntua is offline   Reply With Quote
Old 11-07-2009, 08:26 AM   #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?
daghenningsorbo is offline   Reply With Quote
Old 11-07-2009, 10:22 AM   #4
subminimalist
 
MK27's Avatar
 
Join Date: Jul 2008
Location: NYC
Posts: 3,944
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.
__________________

Accuracy and integrity mean nothing if you don't make it past the censors...PYTHAGORAS

Last edited by MK27; 11-07-2009 at 10:27 AM.
MK27 is offline   Reply With Quote
Old 11-07-2009, 10:38 AM   #5
ZuK
Registered User
 
Join Date: Aug 2005
Posts: 1,303
Many protocols use the character value 0x06 for ACKnowledgement.
Kurt
ZuK is offline   Reply With Quote
Old 11-07-2009, 10:43 AM   #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?
daghenningsorbo is offline   Reply With Quote
Old 11-07-2009, 10:50 AM   #7
subminimalist
 
MK27's Avatar
 
Join Date: Jul 2008
Location: NYC
Posts: 3,944
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.
__________________

Accuracy and integrity mean nothing if you don't make it past the censors...PYTHAGORAS
MK27 is offline   Reply With Quote
Old 11-07-2009, 12:14 PM   #8
Registered User
 
Join Date: Dec 2006
Posts: 19
Thank you for your answer. That cleared things up for me.
daghenningsorbo is offline   Reply With Quote
Reply

Tags
ack, tcp

Thread Tools
Display Modes

Forum Jump

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


All times are GMT -6. The time now is 06:09 AM.


Powered by vBulletin® Version 3.8.1
Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.3.0 RC2

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22