Article View: borland.public.cppbuilder.internet.socket
Article #565Re: Using TIdTCPServer
From: Remy Lebeau (TeamB)
Date: Thu, 24 Jan 2008 20:04
Date: Thu, 24 Jan 2008 20:04
34 lines
2573 bytes
2573 bytes
"Peter" <piotrtrzeciak@yahoo.com> wrote in message news:4798db8f$1@newsgroups.borland.com... > When getting the binary data, first I get a piece that contains a > binary code that says "image", and then I have to read that image > (not knowing how big it is). In that situation, there are only three reliable ways to detect when arbitrary binary data has finished being sent: 1) the server sends the data length beforehand (which it sounds like from yor descriptions that it is not) 2) the server sends a unique terminator byte/sequence to mark the end of the image data. You would have to look for that terminator while reading so you don't accidentally receive too much data if another packet follows the image data right away. 3) the server disconnects the connection at the end of the file. If the same socket connection is being used for both types of data transmissions, where your custom communication packets can arrive after the image is finished (without having to reconnect to the server), then #3 is not a viable option. It has to be doing either #1 or #2 to ensure the integrity of the communication. If the server is not doing any of those options, then the only other thing I can think of is to see if the image data itself has its own header that specifies the data size, assuming the same image format is being used each time. Gambit
Technical Details
Message-ID:
<4798ef34$2@newsgroups.borland.com>Path:
arc1-ca.pugleaf.net!g2news1.google.com!news1.google.com!eweka.nl!lightspeed.eweka.nl!213.239.142.3.MISMATCH!feed.xsnews.nl!border-2.ams.xsnews.nl!newsfeed.freenet.de!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mailReferences:
<478e1c34$1@newsgroups.borland.com> <478e4760@newsgroups.borland.com> <4798a5e1$1@newsgroups.borland.com> <4798cf30$1@newsgroups.borland.com> <4798db8f$1@newsgroups.borland.com>Show Full Headers
Complete Article Headers
X-Google-Thread: 11508e,452e664b18b0b56c X-Google-Attributes: gid11508e,public,usenet X-Google-Language: ENGLISH,ASCII-7-bit From: "Remy Lebeau \(TeamB\)" <no.spam@no.spam.com> Newsgroups: borland.public.cppbuilder.internet.socket References: <478e1c34$1@newsgroups.borland.com> <478e4760@newsgroups.borland.com> <4798a5e1$1@newsgroups.borland.com> <4798cf30$1@newsgroups.borland.com> <4798db8f$1@newsgroups.borland.com> Subject: Re: Using TIdTCPServer Date: Thu, 24 Jan 2008 12:04:56 -0800 Lines: 36 Organization: Lebeau Software X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 6.00.2900.3138 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.3198 X-RFC2646: Format=Flowed; Original NNTP-Posting-Host: 207.178.157.90 Message-ID: <4798ef34$2@newsgroups.borland.com> X-Trace: newsgroups.borland.com 1201205044 207.178.157.90 (24 Jan 2008 12:04:04 -0700) Path: arc1-ca.pugleaf.net!g2news1.google.com!news1.google.com!eweka.nl!lightspeed.eweka.nl!213.239.142.3.MISMATCH!feed.xsnews.nl!border-2.ams.xsnews.nl!newsfeed.freenet.de!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail