Article View: borland.public.cppbuilder.internet.socket
Article #4289Re: Create Several TClientSocket C++ Builder
From: mehmed sipahi
Date: Thu, 03 Mar 2005 09:20
Date: Thu, 03 Mar 2005 09:20
62 lines
3005 bytes
3005 bytes
Thanks Huns,
but I want to test my server program.I want to know how many clients can
connect to server at the same time.
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.
2-)if i create about 1000 client using ShellExecute my computer can do it?
I think i ust do it with threads;
My Problem while using thread is that:
1-)I create TClientSocket in Thread::Execute like this
TClientSocket *socket;
socket=new TClientSocket(MainForm);
socket->ClientType=ctNonBlocking;
socket->Name="socket"+StrToInt(MainForm-ThreadTimer->Tag);
socket->Address ="212.456.45.34";
socket->Port=2255;
socket->OnConnect=ChSocket->OnConnect;
socket->OnConnecting=ChSocket->OnConnecting;
socket->OnLookup=ChSocket->OnLookup;
socket->OnRead=ChSocket->OnRead;
socket->OnWrite=ChSocket->OnWrite;
socket->OnError=ChSocket->OnError;
socket->OnDisconnect=ChSocket->OnDisconnect;
socket->Open();
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
"Hans Galema" <notused@notused.nl> wrote in message
news:4225f97d$1@newsgroups.borland.com...
> mehmed sipahi wrote:
>
>> My app. basicly connect a server via a TCP Socket.
>> I want to test the server performance so i am coding a test client..
>>
>> How can I create several TClientSocket and connect the server on one
>> client??I Know I must use thread but how?
>
> What problems do you have exactly ? How do you create one TClientSocket
> now then ? Why do you need threads ?
>
> But: You better make -and faster- another app that starts your client a
> 100 times.
>
> int clientnr = -1;
> while ( ++clientnr < 100 )
> {
> ShellExecute ( ... your client ... );
>
> }
>
> That would be all!
>
> Hans.
Technical Details
Message-ID:
<4226d6c7$1@newsgroups.borland.com>Path:
arc1-ca.pugleaf.net!g2news1.google.com!news3.google.com!newshub.sdsu.edu!border1.nntp.dca.giganews.com!nntp.giganews.com!newshosting.com!nx02.iad01.newshosting.com!news-out.newsfeeds.com!propagator3-LAX.newsfeeds.com!news-in.usenet.com!newsfeeds.ihug.co.nz!ihug.co.nz!newsgroups.borland.com!not-for-mailReferences:
<4225d0f1@newsgroups.borland.com> <4225f97d$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 Reply-To: "mehmed sipahi" <furkan.atli@mobinex.com.tr> From: "mehmed sipahi" <furkan.atli@mobinex.com.tr> Newsgroups: borland.public.cppbuilder.internet.socket References: <4225d0f1@newsgroups.borland.com> <4225f97d$1@newsgroups.borland.com> Subject: Re: Create Several TClientSocket C++ Builder Date: Thu, 3 Mar 2005 11:20:04 +0200 Lines: 64 X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 6.00.2900.2180 X-RFC2646: Format=Flowed; Response X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.2180 NNTP-Posting-Host: 193.140.214.69 Message-ID: <4226d6c7$1@newsgroups.borland.com> X-Trace: newsgroups.borland.com 1109841607 193.140.214.69 (3 Mar 2005 01:20:07 -0800) Path: arc1-ca.pugleaf.net!g2news1.google.com!news3.google.com!newshub.sdsu.edu!border1.nntp.dca.giganews.com!nntp.giganews.com!newshosting.com!nx02.iad01.newshosting.com!news-out.newsfeeds.com!propagator3-LAX.newsfeeds.com!news-in.usenet.com!newsfeeds.ihug.co.nz!ihug.co.nz!newsgroups.borland.com!not-for-mail