Article View: borland.public.cppbuilder.internet.socket
Article #4925Re: initialising a ClientSocket
From: Mark Jacobs
Date: Wed, 17 Nov 2004 14:03
Date: Wed, 17 Nov 2004 14:03
73 lines
3759 bytes
3759 bytes
If it couldn't connect through my app, then there is a problem with the
connection. If you can connect to it in the main app's constructor, are you
sure the connection is valid, and not formed by unitinitialised handlers or
properties? Can you send and receive stuff using this constructor-created
connection? I bet not. If you have recently upgraded to, or are using SP2,
that opens up the possibility of the in-built firewall stopping the
connection. Whatever happens, my app (
http://www.jacobsm.com/mathspenknife.exe ) should be able to connect if there
is any possibility of connection. The other possibility is that your IP
address has been NAT'd (you're on a VPN - this is really mnemonics-ville!),
and the IP address supplied is invalid in the VPN context.
I would move all form-element-dependent initialisation code from the
constructor of the form, to the OnPaint event for the form, and code it like
this :-
void __fastcall TMainForm::FormPaint(TObject *Sender)
{
static bool clld=false;
if (clld) return;
clld=true;
//... initialisation code goes here
}
--
Mark Jacobs
DK Computing
http://www.dkcomputing.co.uk
"duncan" <no_spam@spamsucks.com> wrote in message
news:4198d30f$1@newsgroups.borland.com...
|
| Hans,
|
| >You forgot to assign the OnConnect eventhandler ?
|
| I believe the OnConnect event handler is assigned in
|
| void NetworkSupport::set_file_components
| (TServerSocket * const ServerSocket,
| TClientSocket * const ClientSocket)
|
| // Assign the components
| ClientSocket = _file_client_pointer;
|
| //initialise file client
| ClientSocket->Address = "10.98.88.34";
| ClientSocket->Port = 7017;
| ClientSocket->Open();
|
| //Assign the client events
| ClientSocket -> OnConnect = file_client_connect;
| ClientSocket -> OnConnecting = file_client_connecting;
| ClientSocket -> OnDisconnect = file_client_disconnect;
| ClientSocket -> OnError = file_client_error;
| ClientSocket -> OnLookup = file_client_lookup;
| ClientSocket -> OnRead = file_client_read;
| ClientSocket -> OnWrite = file_client_write;
|
| The above works, (ClientSocket -> OnConnect is called) however when
|
| ClientSocket->Address = "10.98.88.34";
| ClientSocket->Port = 7017;
| ClientSocket->Open();
|
| is moved to the OnClick instead, the ClientSocket -> OnConnect
| is not called.
|
| do I need to assign the OnClick eventhandler someware else?
|
| Thanks
|
| Duncan
|
Technical Details
Message-ID:
<419b5a36$1@newsgroups.borland.com>Path:
arc1-ca.pugleaf.net!g2news1.google.com!news3.google.com!news.glorb.com!newsfeed00.sul.t-online.de!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> <4198a148$1@newsgroups.borland.com> <4198aed9$1@newsgroups.borland.com> <4198b1a6$1@newsgroups.borland.com> <4198be15@newsgroups.borland.com> <4198cb39$1@newsgroups.borland.com> <4198cf03$1@newsgroups.borland.com> <4198d30f$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 From: "Mark Jacobs" <http://www.jacobsm.com/mjmsg?Borland%20Newsgroup> Newsgroups: borland.public.cppbuilder.internet.socket References: <41938125$1@newsgroups.borland.com> <4193a0bb@newsgroups.borland.com> <41989b78$1@newsgroups.borland.com> <4198a148$1@newsgroups.borland.com> <4198aed9$1@newsgroups.borland.com> <4198b1a6$1@newsgroups.borland.com> <4198be15@newsgroups.borland.com> <4198cb39$1@newsgroups.borland.com> <4198cf03$1@newsgroups.borland.com> <4198d30f$1@newsgroups.borland.com> Subject: Re: initialising a ClientSocket Date: Wed, 17 Nov 2004 14:03:47 -0000 Lines: 75 Organization: DK Computing X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 6.00.2800.1437 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1441 NNTP-Posting-Host: 81.144.157.8 Message-ID: <419b5a36$1@newsgroups.borland.com> X-Trace: newsgroups.borland.com 1100700214 81.144.157.8 (17 Nov 2004 06:03:34 -0700) Path: arc1-ca.pugleaf.net!g2news1.google.com!news3.google.com!news.glorb.com!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail