🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: borland.public.cppbuilder.internet.socket
Article #5010

Re: initialising a ClientSocket

#5010
From: Vladimir Stefanovic
Date: Thu, 11 Nov 2004 17:25
35 lines
1997 bytes
> I have found that if I initialise the client in the  [...]

Show the actual code.

> However if I initialise my client after this, (dynamically),
> say in the OnClick method of a button, then the file_client_pointer
> is never Active and no messages get sent because
> no connection is made.

Show the actual code.

> I really need to have the ability to dynamically connect to
> another PC as the user will be given the choice of which
> PC he would like to talk to?

You can use *one* TClientSocket, and in a loop connect to
many servers / pseudo /

loop ( i )
{
   file_client_pointer->Active = false;
   file_client_pointer->Port = 7000;
   file_client_pointer->Host = GetAnotherHost( i );
   file_client_pointer->Active = true;
}

This is just psudo code which in practice has to be
modified to handle exceptions, like fast skiping non-listening
servers, etc.




Best regards,
Vladimir Stefanovic
Technical Details
Message-ID: <4193a0bb@newsgroups.borland.com>
Path: arc1-ca.pugleaf.net!g2news1.google.com!news1.google.com!news2.google.com!newsread.com!newsprint.newsread.com!news-out2.kabelfoon.nl!83.128.0.10.MISMATCH!newsfeed.kabelfoon.nl!216.196.110.149.MISMATCH!border2.nntp.ams.giganews.com!nntp.giganews.com!news-hub.cableinet.net!blueyonder!news-peer-test!btnet!newsfeed.bt.es!caladan.landsraad.net!newsgroups.borland.com!not-for-mail
References: <41938125$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: "Vladimir Stefanovic" <spam@not.needed>
Newsgroups: borland.public.cppbuilder.internet.socket
References: <41938125$1@newsgroups.borland.com>
Subject: Re: initialising a ClientSocket
Date: Thu, 11 Nov 2004 18:25:48 +0100
Lines: 38
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 5.00.2314.1300
X-MimeOLE: Produced By Microsoft MimeOLE V5.00.2314.1300
NNTP-Posting-Host: 213.137.116.228
Message-ID: <4193a0bb@newsgroups.borland.com>
X-Trace: newsgroups.borland.com 1100193979 213.137.116.228 (11 Nov 2004 09:26:19 -0700)
Path: arc1-ca.pugleaf.net!g2news1.google.com!news1.google.com!news2.google.com!newsread.com!newsprint.newsread.com!news-out2.kabelfoon.nl!83.128.0.10.MISMATCH!newsfeed.kabelfoon.nl!216.196.110.149.MISMATCH!border2.nntp.ams.giganews.com!nntp.giganews.com!news-hub.cableinet.net!blueyonder!news-peer-test!btnet!newsfeed.bt.es!caladan.landsraad.net!newsgroups.borland.com!not-for-mail