Article View: borland.public.cppbuilder.internet.socket
Article #5503How to skip non-listening servers?
From: Vladimir Stefanovic
Date: Mon, 16 Aug 2004 12:20
Date: Mon, 16 Aug 2004 12:20
42 lines
2055 bytes
2055 bytes
Hi,
I wanted to send instant messages from one PC (TClientSocket) to
some other PCs (TServerSocket) in LAN which are in the list:
Rcp = new TLanRecipients();
Rcp->Add ( "1.1.1.1", "Message 1" );
Rcp->Add ( "1.1.1.2", "Message 2" );
Rcp->Add ( "1.1.1.3", "Message 3" );
// ...
Port for both sides is nagotiated before (say 1200), and ClientType
is ctBlocking. ServerType is stNonBlocking.
void TLanService::SendLanMessages()
{
for ( int i=0; i<Rcp->Count(); i++ )
{
ClientSocket->Active = false;
ClientSocket->Address = Rcp->GetIP( i );
ClientSocket->Active = true;
if ( ClientSocket->Active == true )
ClientSocket->Socket->SendText( Rcp->GetMsg( i ) );
}
}
This code works fine *only* when ALL three destination PCs in LAN
are active and waiting for message. But when, for example, the
first in the list is not active (the service is stopped/paused/
uninstalled), the loop waits - and other recipients though cannot
be informed.
What should I change in the concept of this code, to ignore the
non-listening PCs?
Best regards,
Vladimir Stefanovic
Technical Details
Message-ID:
<4120a678$1@newsgroups.borland.com>Path:
arc1-ca.pugleaf.net!g2news1.google.com!news2.google.com!news.maxwell.syr.edu!newsfeed.icl.net!news-FFM2.ecrc.net!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mailShow Full Headers
Complete Article Headers
X-Google-Thread: 11508e,2834a5512f17f129,start X-Google-Attributes: gid11508e,public X-Google-Language: ENGLISH,ASCII-7-bit From: "Vladimir Stefanovic" <antivari@ptt.yu> Sender: "Vladimir Stefanovic" <antivari@ptt.yu> Reply-To: "Vladimir Stefanovic" <antivari@ptt.yu> Subject: How to skip non-listening servers? Newsgroups: borland.public.cppbuilder.internet.socket X-User-Info: 213.137.116.152 X-Forwarded-For: 128.128.129.165 NNTP-Posting-Host: 207.105.83.66 Message-ID: <4120a678$1@newsgroups.borland.com> Date: 16 Aug 2004 05:20:08 -0700 X-Trace: newsgroups.borland.com 1092658808 207.105.83.66 (16 Aug 2004 05:20:08 -0700) Lines: 43 Path: arc1-ca.pugleaf.net!g2news1.google.com!news2.google.com!news.maxwell.syr.edu!newsfeed.icl.net!news-FFM2.ecrc.net!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail