Solved

idTCPClient acknowledgement to server disconnect

Posted on 2008-06-18
5
966 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 2
5 Comments
 
LVL 17

Accepted Solution

by:
TheRealLoki earned 500 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

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

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…
Introduction Raise your hands if you were as upset with FireMonkey as I was when I discovered that there was no TListview.  I use TListView in almost all of my applications I've written, and I was not going to compromise by resorting to TStringGrid…
I've attached the XLSM Excel spreadsheet I used in the video and also text files containing the macros used below. https://filedb.experts-exchange.com/incoming/2017/03_w12/1151775/Permutations.txt https://filedb.experts-exchange.com/incoming/201…

737 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