Mega Search
23.2 Million


Sign Up

Make a donation  
Single TCP server, multiple client  
News Group: embarcadero.public.cppbuilder.internet.socket

Hi!

As I mentioned in the subject my aim is to write a little programm which use one TTcpServer componenet whith multiple client connection possibility. 

So I create a Thread which can handle the incoming connection requests (this thread contains the TTcpServer componenet).
My plan was the following:

- When a new client accepted the 

*void __fastcall TCPServerThread::TcpServerAccept(TObject *Sender, TCustomIpClient *ClientSocket)*

method called. As you can see at this time I get the ClientSocket pointer which is a representation of the accepted client. So 
I thought that If I put this pointer into an array (or a map) later I can access the accepted clients from this array. But after the TcpServerAccept method finished the ClientSocket's in the array becomes a Disconnected state.

Can you tell me why, or can you provide a sample? I found a few sample on the internet but these samples show a Single TCP server Single Client solution... :(


Thanks the answer in advance!

Csaba

Vote for best question.
Score: 0  # Vote:  0
Date Posted: 16-Jun-2014, at 7:41 AM EST
From: Csaba Urban
 
Re: Single TCP server, multiple client  
News Group: embarcadero.public.cppbuilder.internet.socket
Well, based on your answer I changed to the IndyTCP componenet and now I think I can solve my problem.
Thank You!

Vote for best answer.
Score: 0  # Vote:  0
Date Posted: 17-Jun-2014, at 5:24 AM EST
From: Csaba Urban