🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

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

Re: Create Several TClientSocket C++ Builder

#4290
From: Hans Galema
Date: Thu, 03 Mar 2005 10:34
51 lines
2527 bytes
mehmed sipahi wrote:

> but I want to test my server program.I want to know how many clients can 
> connect to server at the same time.

That I had understood perfectly.

> I can use ShellExecute but
> 1-) I dont know how I pass parameters to my client.Because every client 
> instance must connect to server a seperate user.

ShellExecute takes a commandline as one of the parameters where
you can put the username in. Then your client looks in ParamStr(1)
for the username. (check ParamCount before ).

> 2-)if i create about 1000 client using ShellExecute my computer can do it?

Well that is a simple test to find out yourself.

> I think i ust do it with threads;
> 
> My Problem while using thread is that:
> 1-)I create TClientSocket in Thread::Execute like this

Why would you do that in a thread ?
So in OnConnect you send the username to the server ?
Upon which the server denies or accepts ?

> but i cant connect to server if i can do it in thread..
> 
> out of thread my code work fine but i cant create several client.
> thanks

What is the reason why you can not create instances of
TClientSocket outside a thread ?

But I still advise you to make the startapp. That is definitely
less work.

   int clientnr = -1;
   while ( ++clientnr < 100 )
     {
     AnsiString UserName = "sipahi" + IntToStr ( clientnr );
     ShellExecute (
	... your client ...
	UserName.c_str(),
         .. and other parameters
	);
     }

Hans.
Technical Details
Message-ID: <4226e881$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-mail
References: <4225d0f1@newsgroups.borland.com> <4225f97d$1@newsgroups.borland.com> <4226d6c7$1@newsgroups.borland.com>

Show Full Headers
Complete Article Headers
X-Google-Thread: 11508e,dd6db4c120873d11
X-Google-Attributes: gid11508e,public
X-Google-Language: ENGLISH,ASCII-7-bit
Date: Thu, 03 Mar 2005 11:34:02 +0100
From: Hans Galema <notused@notused.nl>
User-Agent: Mozilla Thunderbird 1.0 (Windows/20041206)
X-Accept-Language: en-us, en
MIME-Version: 1.0
Newsgroups: borland.public.cppbuilder.internet.socket
Subject: Re: Create Several TClientSocket C++ Builder
References: <4225d0f1@newsgroups.borland.com> <4225f97d$1@newsgroups.borland.com> <4226d6c7$1@newsgroups.borland.com>
In-Reply-To: <4226d6c7$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: <4226e881$1@newsgroups.borland.com>
X-Trace: newsgroups.borland.com 1109846145 129.125.201.248 (3 Mar 2005 02:35:45 -0800)
Lines: 51
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