🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: borland.public.cppbuilder.internet.socket
Article #1911

Re: Problem separating messages...

#1911
From: Remy Lebeau (TeamB)
Date: Thu, 28 Sep 2006 18:10
34 lines
2226 bytes
"Josh Arnold" <jarnold@atterotech.com> wrote in message
news:451c0548$1@newsgroups.borland.com...

> The problem is that when my application receives the responses
> they are all lumped together in a single message.

As they should be.  That is how TCP-IP works in general.

> This makes it impossible to parse.

What does the data actually look like?  If the individual message lengths
are not known ahead of time, and there are no unique delimiters between
messages, then there is no way you will be able to handle multiple responses
at a time.  You will have to wait on sending a new request until the
previous response has been recieved first.

> What is the trick to getting the OnRead event to fire onece for
> each message?

There isn't any, because that is not how TCP/IP works to begin with.  TCP/IP
is a byte stream, not a message stream.  The OnRead event is fired when new
bytes arrive, however many that may be.  It is the application's
responsibility, not the socket's, to buffer the bytes and then process them
as formatted messages as needed.

> Does the response from the server need to be terminated with a special
character?

Yes, if the messages are not fixed in length, and the lengths are not being
included inside the message data.


Gambit
Technical Details
Message-ID: <451c10c3$1@newsgroups.borland.com>
Path: arc1-ca.pugleaf.net!g2news2.google.com!news1.google.com!news3.google.com!border1.nntp.dca.giganews.com!border2.nntp.dca.giganews.com!nntp.giganews.com!newspeer1.nwr.nac.net!newsfeeds.ihug.co.nz!ihug.co.nz!newsgroups.borland.com!not-for-mail
References: <451c0548$1@newsgroups.borland.com>

Show Full Headers
Complete Article Headers
X-Google-Thread: 11508e,b4e1115fa22e636b
X-Google-Attributes: gid11508e,public
X-Google-Language: ENGLISH,ASCII-7-bit
From: "Remy Lebeau \(TeamB\)" <no.spam@no.spam.com>
Newsgroups: borland.public.cppbuilder.internet.socket
References: <451c0548$1@newsgroups.borland.com>
Subject: Re: Problem separating messages...
Date: Thu, 28 Sep 2006 11:10:43 -0700
Lines: 36
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 6.00.2800.1409
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1409
NNTP-Posting-Host: 69.169.4.232
Message-ID: <451c10c3$1@newsgroups.borland.com>
X-Trace: newsgroups.borland.com 1159467203 69.169.4.232 (28 Sep 2006 11:13:23 -0700)
Path: arc1-ca.pugleaf.net!g2news2.google.com!news1.google.com!news3.google.com!border1.nntp.dca.giganews.com!border2.nntp.dca.giganews.com!nntp.giganews.com!newspeer1.nwr.nac.net!newsfeeds.ihug.co.nz!ihug.co.nz!newsgroups.borland.com!not-for-mail