Solved

idTCPClient acknowledgement to server disconnect

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

Enroll in July's Course of the Month

July's Course of the Month is now available! Enroll to learn HTML5 and prepare for certification. It's free for Premium Members, Team Accounts, and Qualified Experts.

Question has a verified solution.

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

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 this tutorial I will show you how to use the Windows Speech API in Delphi. I will only cover basic functions such as text to speech and controlling the speed of the speech. SAPI Installation First you need to install the SAPI type library, th…
If you’ve ever visited a web page and noticed a cool font that you really liked the look of, but couldn’t figure out which font it was so that you could use it for your own work, then this video is for you! In this Micro Tutorial, you'll learn yo…
Visualize your data even better in Access queries. Given a date and a value, this lesson shows how to compare that value with the previous value, calculate the difference, and display a circle if the value is the same, an up triangle if it increased…
Suggested Courses
Course of the Month8 days, 10 hours left to enroll

617 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