Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

idTCPClient acknowledgement to server disconnect

Posted on 2008-06-18
5
Medium Priority
?
979 Views
Last Modified: 2010-04-21
Possibly a very dopey request here.  II am a complete newby to INDY.  I have been assigned the task of maintaining an application that delivers message to a server with idTCPClient.  Normally, given the volumes of data transmitted, we leave the socket open after delivery.  All works fine.  

I have a request to acknowledge a FIN message sent by the server if the connection has been in idle for a period of time.  They would like our client application to acknowledge the message to continue with the disconnect.  

We are currently using D6/Indy8(!).

As I do not fully understand the mechanics of Indy, I am not sure where to start.  Can someone give me some pointers on how a FIN message should be acknknowledged.

Thanks.
0
Comment
Question by:kiwi_cola
  • 3
  • 2
5 Comments
 
LVL 17

Accepted Solution

by:
TheRealLoki earned 2000 total points
ID: 21818973
wow, it's been a long time since I've seen a FIN mentioned :-)
There's some info in an RFC here that explains FIN/ACK in some detail
http://tools.ietf.org/html/rfc793

Indy sits a level above this sort of thing, I think you can pretty much just do
IdTCPClient1.Disconnect;
0
 

Author Comment

by:kiwi_cola
ID: 21819064
Thanks for the prompt response!  This gives me a little bit of direction for the solution.

Our thread only wakes up to deliver a message, usually through an existing connected socket. I do not want to change the current application too much.  Is the idTCPClient aware of receiving a FIN packet while the thread is sleeping?  Thanks..
0
 
LVL 17

Expert Comment

by:TheRealLoki
ID: 21819451
I must say I am surprised to see you using Indy 8
You'll not likely get any support from the authors/newsgroups for it.
I only use 9 and 10, so not sure if my sample code will be of any use... still, worth a try :-)

For 1 thing, there is the "UseNagle" option. Not sure if you wish to turn off nagle or not, I'll assume you want the default
(IdTCPClient1.Socket.UseNagle)

indy does this
  if not UseNagle then begin
    Binding.SetSockOpt(Id_IPPROTO_TCP, Id_TCP_NODELAY, PChar(@Id_SO_True), SizeOf(Id_SO_True));

however, there are some other options in IdStackConsts
(accesses by IdTCPClient1.Socket.Binding.SetSockOpt  and IdTCPClient1.Socket.Binding.Reset)
some possible options are
  // Shutdown Options
  Id_SD_Recv = 0;
  Id_SD_Send = 1;
  Id_SD_Both = 2;
  Id_SD_Default = Id_SD_Send;

Most of the ACK/sleep stuff is too low in Indy for me to delve into easily
I am sorry, this is such a long time ago, I really don't think I'm going to be of much more help. :-(
0
 

Author Comment

by:kiwi_cola
ID: 21820170
I think the best solution is to shut the connection after each message is delivered by the idTCPClient.  

Reviewing information I have obtained on the other user groups supports your suggestion to disconnect after delivery.

Thank you for your responses!
0
 

Author Closing Comment

by:kiwi_cola
ID: 31468631
Thank you so much for your time and effort.  From your responses I gained a much greater insight into Indy than hours of reading the copious amounts of doco surrounding Indy.  I will migrate the application to D2006 and Indy 10 as well.  Thanks again.
0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

The uses clause is one of those things that just tends to grow and grow. Most of the time this is in the main form, as it's from this form that all others are called. If you have a big application (including many forms), the uses clause in the in…
Have you ever had your Delphi form/application just hanging while waiting for data to load? This is the article to read if you want to learn some things about adding threads for data loading in the background. First, I'll setup a general applica…
Integration Management Part 2
In response to a need for security and privacy, and to continue fostering an environment members can turn to for support, solutions, and education, Experts Exchange has created anonymous question capabilities. This new feature is available to our Pr…
Suggested Courses

963 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question