Solved

idTCPClient acknowledgement to server disconnect

Posted on 2008-06-18
5
946 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 500 total points
Comment Utility
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
Comment Utility
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
Comment Utility
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
Comment Utility
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
Comment Utility
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

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

Suggested Solutions

Objective: - This article will help user in how to convert their numeric value become words. How to use 1. You can copy this code in your Unit as function 2. than you can perform your function by type this code The Code   (CODE) The Im…
In my programming career I have only very rarely run into situations where operator overloading would be of any use in my work.  Normally those situations involved math with either overly large numbers (hundreds of thousands of digits or accuracy re…
Internet Business Fax to Email Made Easy - With eFax Corporate (http://www.enterprise.efax.com), you'll receive a dedicated online fax number, which is used the same way as a typical analog fax number. You'll receive secure faxes in your email, fr…
This video demonstrates how to create an example email signature rule for a department in a company using CodeTwo Exchange Rules. The signature will be inserted beneath users' latest emails in conversations and will be displayed in users' Sent Items…

763 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

Need Help in Real-Time?

Connect with top rated Experts

6 Experts available now in Live!

Get 1:1 Help Now