Thread View: borland.public.cppbuilder.internet.socket
4 messages
4 total messages
Started by Bashar T
Mon, 12 May 2008 13:03
indy 9 tcpclient and tcpserver
Author: Bashar T
Date: Mon, 12 May 2008 13:03
Date: Mon, 12 May 2008 13:03
6 lines
1086 bytes
1086 bytes
I want to send a simple text to another pc by using indy 9 tcpclient and
tcpserver.
IdTcpClient1->writLen ("mystring");
How can I show my string in a lable by using TCPServer?
Re: indy 9 tcpclient and tcpserver
Author: Remy Lebeau (TeamB)
Date: Mon, 12 May 2008 16:56
Date: Mon, 12 May 2008 16:56
87 lines
3084 bytes
3084 bytes
"Bashar T" <bashar-t@scs-net.org> wrote in message
news:48284026$1@newsgroups.borland.com...
> How can I show my string in a lable by using TCPServer?
class TLabelSync : public TIdSync
{
private:
TLabel *FLabel;
AnsiString FText;
protected
void __fastcall DoSynchronize()
{
FLabel->Caption = FText;
}
public:
TLabelSync(TLabel *ALabel, const AnsiString &AText)
: TIdSync(), FLabel(ALabel), FText(AText)
{
}
static void __fastcall Update(TLabel *ALabel, const AnsiString
&AText)
{
TLabelSync *sync = new TLabelSync(ALabel, AText);
try {
sync->Synchronize();
}
__finally {
delete sync;
}
}
};
void __fastcall TForm1::IdTCPServer1Execute(TIdPeerThread *AThread)
{
AnsiString Line = AThread->Connection->ReadLn();
TLabelSync::Update(Label1, Line);
}
Alternatively:
class TLabelNotify : public TIdNotify
{
private:
TLabel *FLabel;
AnsiString FText;
protected
void __fastcall DoNotify()
{
FLabel->Caption = FText;
}
public:
TLabelNotify(TLabel *ALabel, const AnsiString &AText)
: TIdNotify(), FLabel(ALabel), FText(AText)
{
}
static void __fastcall Update(TLabel *ALabel, const AnsiString
&AText)
{
TLabelNotify *notif = new TLabelNotify(ALabel, AText);
try {
sync->Notify();
}
catch(const Exception &)
{
delete notif;
throw;
}
}
};
void __fastcall TForm1::IdTCPServer1Execute(TIdPeerThread *AThread)
{
AnsiString Line = AThread->Connection->ReadLn();
TLabelNotify::Update(Label1, Line);
}
Gambit
Re: indy 9 tcpclient and tcpserver
Author: Bashar T
Date: Tue, 13 May 2008 21:24
Date: Tue, 13 May 2008 21:24
5 lines
1020 bytes
1020 bytes
when I add this class TLabelSync : public TIdSync I get E2303 Typenaem expected what is the wrong
Re: indy 9 tcpclient and tcpserver
Author: Remy Lebeau (TeamB)
Date: Tue, 13 May 2008 22:12
Date: Tue, 13 May 2008 22:12
14 lines
1301 bytes
1301 bytes
"Bashar T" <bashar-t@scs-net.org> wrote in message news:482a071e@newsgroups.borland.com... > when I add this > class TLabelSync : public TIdSync > I get > E2303 Typenaem expected > what is the wrong You probably did not #include the IdSync.hpp header file in your code. Gambit
Thread Navigation
This is a paginated view of messages in the thread with full content displayed inline.
Messages are displayed in chronological order, with the original post highlighted in green.
Use pagination controls to navigate through all messages in large threads.
Back to All Threads