Article View: borland.public.cppbuilder.internet.socket
Article #785Re: Multicast receiver program problem !!
From: Remy Lebeau (TeamB)
Date: Thu, 08 Nov 2007 04:12
Date: Thu, 08 Nov 2007 04:12
22 lines
1708 bytes
1708 bytes
"Shiu-Huei-Huang" <huei.huan@msa.hinet.net> wrote in message news:473285e6$1@newsgroups.borland.com... > I write a multicast receiver program ! > But It doesnt work! Just saying that something does not work says nothing about the actual problem you are having with it. You need to be more specific. > char RcvMsg[8192]; > AData->ReadBuffer(RcvMsg,sizeof(RcvMsg)); > RcvLogMemo1->Lines->Add(AnsiString(RcvMsg)); You are not checking the return value of ReadBuffer() or the Size property of AData to know how many bytes have actually been received. You are also not taking into account that the OnRead event is triggered in the context of a worker thread, not the main thread, so your access to the TMemo is not thread-safe. Gambit
Technical Details
Message-ID:
<47328cb1$1@newsgroups.borland.com>Path:
arc1-ca.pugleaf.net!g2news1.google.com!news2.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-mailReferences:
<473285e6$1@newsgroups.borland.com>Show Full Headers
Complete Article Headers
X-Google-Thread: 11508e,8906a097af4769c4 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: <473285e6$1@newsgroups.borland.com> Subject: Re: Multicast receiver program problem !! Date: Wed, 7 Nov 2007 20:12:49 -0800 Lines: 24 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: 75.83.29.61 Message-ID: <47328cb1$1@newsgroups.borland.com> X-Trace: newsgroups.borland.com 1194495153 75.83.29.61 (7 Nov 2007 20:12:33 -0700) Path: arc1-ca.pugleaf.net!g2news1.google.com!news2.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 X-Original-Bytes: 1567