Board index » delphi » Indy TCPServer send data to client

Indy TCPServer send data to client

I Have an Indy Server component.
30 Clients connects to this server.
I want to send data to the 14th
client.

Label1->Caption = "Connecting to: " + Server->Bindings->Items[14]->PeerIP;
// sending data..

Server->Bindings->Items[14]-> ???

Who do I have to use to send the data. There is not WriteLn function on it.

Any help?

Nick

 

Re:Indy TCPServer send data to client


Quote
Nick wrote:
> I Have an Indy Server component.
> 30 Clients connects to this server.
> I want to send data to the 14th
> client.

> Label1->Caption = "Connecting to: " + Server->Bindings->Items[14]->PeerIP;
> // sending data..

> Server->Bindings->Items[14]-> ???

> Who do I have to use to send the data. There is not WriteLn function on it.

> Any help?

> Nick

A separate thread is created for each client connection that is recieved
by your server component.  These threads execute the function identified
in the OnExecute event handler for your server component.  Data that is
to be transmitted to a client must be sent via the WriteLn() of the
Connection property of the thread object that is passed in as a
parameter to the OnExecute event handler function.

There is a thread collection property in the server component, so your
GUI thread should be able to enumerate & manipulate all of the threads
associated with client connections.  You should be able to write your
code so that you can  identify a particular client connection thread and
trigger it to send data to its connected client.

HTH,

Chuck
--
Chuck Chopp

ChuckCh...@rtfmcsi.com            http://www.rtfmcsi.com
                                   ICQ # 22321532
RTFM Consulting Services Inc.     864 801 2795 voice & voicemail
103 Autumn Hill Road              864 801 2774 fax
Greer, SC  29651                  800 774 0718 pager
                                   8007740...@skytel.com

Re:Indy TCPServer send data to client


Accept() returns socket id when there is a new connection by kernel.
so you can store  these socket ids in array or which method you want.Then
you can use this
winsock.send(socketid(52,56 etc..).............);

Best Regards

Sercan ?z

Quote
Nick <n...@nospam.com> wrote in message news:3ccfd5cb_2@dnews...
> I Have an Indy Server component.
> 30 Clients connects to this server.
> I want to send data to the 14th
> client.

> Label1->Caption = "Connecting to: " + Server->Bindings->Items[14]->PeerIP;
> // sending data..

> Server->Bindings->Items[14]-> ???

> Who do I have to use to send the data. There is not WriteLn function on
it.

> Any help?

> Nick

Other Threads