Article View: borland.public.cppbuilder.internet.socket
Article #5215Dynamically create TIdTCPServer in a class
From: James
Date: Sat, 02 Oct 2004 14:06
Date: Sat, 02 Oct 2004 14:06
35 lines
1870 bytes
1870 bytes
Hi!
I'm trying to write a class which manages all the network comms in my
application. Ideally, I'd like the class to create and free the TCP Server
itself.
I'm having real problems setting the TCP Server to Active. After running the
code below, the TIdTCPServer's Active property is still false.
Obviously I'm missing something! Has anyone any thoughts? Thanks in advance
for any advice you can give. I have Google'd this, and nothing came up.
TNCom::TNCom()
{
TCPServer = new TIdTCPServer(NULL);
TCPServer->DefaultPort = 9590;
TCPServer->OnConnect = TCPServerConnect;
TCPServer->Active = true;
}
void __fastcall TNCom::TCPServerConnect(TIdPeerThread *AThread)
{
MessageBeep(0); // for test purposes!
}
void __fastcall TNCom::TCPServerExecute(TIdPeerThread *AThread)
{
MessageBeep(0); // for test purposes!
}
I've omitted the destructor in quoting this code, by the way.
Cheers,
- James
Technical Details
Message-ID:
<415eb5c8$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,8070b28a061afe85,start X-Google-Attributes: gid11508e,public X-Google-Language: ENGLISH,ASCII-7-bit From: "James" <jb9@btinternet.com> Newsgroups: borland.public.cppbuilder.internet.socket Subject: Dynamically create TIdTCPServer in a class Date: Sat, 2 Oct 2004 15:06:04 +0100 Lines: 37 X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 6.00.2900.2180 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.2180 X-RFC2646: Format=Flowed; Original NNTP-Posting-Host: 217.43.81.220 Message-ID: <415eb5c8$1@newsgroups.borland.com> X-Trace: newsgroups.borland.com 1096725960 217.43.81.220 (2 Oct 2004 07:06:00 -0700) 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