Article View: borland.public.cppbuilder.internet.socket
Article #1434Re: Indy TCPServer, client disconnects not detected
From: Dennis Jones
Date: Tue, 16 Jan 2007 16:22
Date: Tue, 16 Jan 2007 16:22
79 lines
4018 bytes
4018 bytes
"Remy Lebeau (TeamB)" <no.spam@no.spam.com> wrote in message news:45ac97b6@newsgroups.borland.com... > > Then you are doing something wrong in your server code. Even if a > client is lost abnormally, your code should not be hitting the CPU > that hard. If it is, then you are not protecting your code properly. I know that! I just don't know what is wrong yet because the application has been working fine until this abnormal disconnect issue came up! > Then the client is likely being disconnected abnormally on its end of > the connection, probably by a firewall or a faulty network. The > server cannot detect abnormal disconnects from its end in a timely > fashion. To do that would require you to implement a keep-alive > mechanism into your data protocol. It isn't *my* protocol and keep-alive isn't supported. > What you have described is > certainly not a graceful disconnect, which leaves only an abnormal > disconnect. Okay, that's good to know, and gives me something to pass on to the customer. > Your server code needs to keep track of idle periods on each > connection, and then close any connections that sit around doing > nothing for awhile. Which I am already doing... >> Below is a *simplified* snippet of my TCPServerExecute method. > > That is hardly simplified. Sorry, I meant logic-wise. All the code does is receive the data and handle exceptions. > You don't need exception handlers to know what is going on with the > client. ReadFromStack() reports that information. Try the following > code instead: Okay <code snipped>, I'm not an Indy expert and wasn't aware of this method. Thanks for the code, though I probably won't change anything right away since it doesn't solve the immediate problem (but I will pull out the debug exception handlers). > During a graceful disconnect, yes. Graceful disconnects are > negotiated operations. Didn't know that either. Thank you. >> Any suggestions for how I might go about determining the cause of >> client disconnects not getting detected? > > I suggest you turn off any frewalls that are between the client and > server, and use an external packet sniffer to watch the TCP traffic to > ensure everythng is being transmitted properly. There probably are not any firewalls between the client and the server, but it is possible -- I'll have to pass that question along to the customer. I have no access to any of my customers' systems as they have very tight security and legal restrictions they must adhere to. Therefore, running a packet sniffer is definitely out of the question, not to mention that they are probably on the other side of the country, which makes it impossible for me to do anything directly. So I'm going to have to resolve this on my end. Thanks for the feedback and the ReadFromStack tip. I'm sure it will come in handy. - Dennis
Technical Details
Message-ID:
<45acfb9f$1@newsgroups.borland.com>Path:
arc1-ca.pugleaf.net!g2news2.google.com!news3.google.com!border1.nntp.dca.giganews.com!nntp.giganews.com!newsfeed00.sul.t-online.de!t-online.de!newsfeed.freenet.de!news.albasani.net!feeder06.uucp-net.de!reader.uucp.at!feeder02.uucp.at!feeder08.uucp.at!news.uucp.at!newsgroups.borland.com!not-for-mailReferences:
<45a86ffe$1@newsgroups.borland.com> <45ac97b6@newsgroups.borland.com>Show Full Headers
Complete Article Headers
X-Google-Thread: 11508e,144f6b6a05bf12ad X-Google-Attributes: gid11508e,public X-Google-Language: ENGLISH,ASCII-7-bit From: "Dennis Jones" <nospam@nospam.com> Newsgroups: borland.public.cppbuilder.internet.socket References: <45a86ffe$1@newsgroups.borland.com> <45ac97b6@newsgroups.borland.com> Subject: Re: Indy TCPServer, client disconnects not detected Date: Tue, 16 Jan 2007 08:22:14 -0800 Lines: 81 X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 6.00.2900.3028 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.3028 X-RFC2646: Format=Flowed; Original NNTP-Posting-Host: 71.245.109.58 Message-ID: <45acfb9f$1@newsgroups.borland.com> X-Trace: newsgroups.borland.com 1168964511 71.245.109.58 (16 Jan 2007 08:21:51 -0800) Path: arc1-ca.pugleaf.net!g2news2.google.com!news3.google.com!border1.nntp.dca.giganews.com!nntp.giganews.com!newsfeed00.sul.t-online.de!t-online.de!newsfeed.freenet.de!news.albasani.net!feeder06.uucp-net.de!reader.uucp.at!feeder02.uucp.at!feeder08.uucp.at!news.uucp.at!newsgroups.borland.com!not-for-mail