Solved

idTCPClient acknowledgement to server disconnect

Posted on 2008-06-18
5
958 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
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

Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
delphi exception 7 64
error 1.1 400 Bad request idhttp delphi 18 86
Printing problem 2 91
Dev Express grid collapse 2 44
This article explains how to create forms/units independent of other forms/units object names in a delphi project. Have you ever created a form for user input in a Delphi project and then had the need to have that same form in a other Delphi proj…
Introduction The parallel port is a very commonly known port, it was widely used to connect a printer to the PC, if you look at the back of your computer, for those who don't have newer computers, there will be a port with 25 pins and a small print…
This Micro Tutorial demonstrates using Microsoft Excel pivot tables, how to reverse engineer competitors' marketing strategies through backlinks.
Windows 10 is mostly good. However the one thing that annoys me is how many clicks you have to do to dial a VPN connection. You have to go to settings from the start menu, (2 clicks), Network and Internet (1 click), Click VPN (another click) then fi…

815 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

13 Experts available now in Live!

Get 1:1 Help Now