Article View: borland.public.cppbuilder.internet.socket
Article #5012Re: initialising a ClientSocket
From: hans galema
Date: Mon, 15 Nov 2004 12:30
Date: Mon, 15 Nov 2004 12:30
55 lines
2608 bytes
2608 bytes
duncan wrote:
> My app runs on two dirrerent computers
> Application->CreateForm(__classid(TMap), &Map);
> TMap is a Frame \
Did not know that CreateForm takes a TFrame. But if you say so ..
Doesn't a TFrame need a Tform at runtime ?
> ClientSocket = new TClientSocket(this);
> ServerSocket = new TServerSocket(this);
Your app will be a client OR a server ? If so there is
no need to instantiate a client and a server here.
> (TServerSocket * const _file_server_pointer,
> TClientSocket * const _file_client_pointer)
What is the reason that you just don't use the borland nameconvention:
TServerSocket * ServerSocket,
TClientSocket * ClientSocket)
The advantage of the latter is that everybody who sees
your code at any place knows where it is all about.
> // Assign the server events
Those are only needed if your app becomes a server
> //Assign the client events
ditto for a client
> file_client_pointer->Open();
>
> if(file_client_pointer->Active)
> {
no. not here
> file_client_pointer->Socket->SendText("test_message");
> }//if
>
> }//
>
> then when file_client_pointer->Open(); is executed it calls all
> of the file_server_connect services on the server side, but not of the client events are called and
> file_client_pointer->Active remains false and the code is not executed?
I already told you the possible reason in my first post. You should
not Sendtext in the same OnClick handler. Instead implement the
OnConnect event of TClientSocket.
Hans.
Technical Details
Message-ID:
<4198a148$1@newsgroups.borland.com>Path:
arc1-ca.pugleaf.net!g2news1.google.com!news1.google.com!proxad.net!gatel-ffm!gatel-ffm!194.25.134.126.MISMATCH!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mailReferences:
<41938125$1@newsgroups.borland.com> <4193a0bb@newsgroups.borland.com> <41989b78$1@newsgroups.borland.com>Show Full Headers
Complete Article Headers
X-Google-Thread: 11508e,f81efd77741cef0b X-Google-Attributes: gid11508e,public X-Google-Language: ENGLISH,ASCII-7-bit Date: Mon, 15 Nov 2004 13:30:03 +0100 From: hans galema <notused@notused.nl> User-Agent: Mozilla Thunderbird 0.8 (Windows/20040913) X-Accept-Language: en-us, en MIME-Version: 1.0 Newsgroups: borland.public.cppbuilder.internet.socket Subject: Re: initialising a ClientSocket References: <41938125$1@newsgroups.borland.com> <4193a0bb@newsgroups.borland.com> <41989b78$1@newsgroups.borland.com> In-Reply-To: <41989b78$1@newsgroups.borland.com> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit NNTP-Posting-Host: 129.125.201.248 Message-ID: <4198a148$1@newsgroups.borland.com> X-Trace: newsgroups.borland.com 1100521800 129.125.201.248 (15 Nov 2004 04:30:00 -0700) Lines: 55 Path: arc1-ca.pugleaf.net!g2news1.google.com!news1.google.com!proxad.net!gatel-ffm!gatel-ffm!194.25.134.126.MISMATCH!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail