Thread View: borland.public.cppbuilder.internet.socket
3 messages
3 total messages
Started by Didier
Thu, 12 May 2005 19:50
How to know the number of the connection in using serversocket?
Author: Didier
Date: Thu, 12 May 2005 19:50
Date: Thu, 12 May 2005 19:50
12 lines
1694 bytes
1694 bytes
Hello; I 'm using a serversocket to make dialog beetween one pc and many machines; these machines are connecting to my pc via the serversocket Object ; so I 'm getting the informations transmitted by the method OClientRead (Socket.ReceiveBuf etc...); Now I 'd like to send an ack to the machine ;so I want to use Socket->Connections[x]->SendText etc.. The problem is that I don't know hot to get the value x ! I 've tried with a fix value (0) and it's ok when I have only one machine connected ; but whe there are many machines there are many connections so I have to know the number of the connection I have to tell that i 'm usin a nonblocking Servertype
Re: How to know the number of the connection in using serversocket?
Author: Hans Galema
Date: Thu, 12 May 2005 19:55
Date: Thu, 12 May 2005 19:55
25 lines
1612 bytes
1612 bytes
Didier wrote:
> (Socket.ReceiveBuf etc...);
> Now I 'd like to send an ack to the machine ;so I want to use
> Socket->Connections[x]->SendText etc..
void __fastcall TForm1::ServerSocket1ClientRead(TObject *Sender,
TCustomWinSocket *Socket)
{
// Socket is the socket for the actual client.
// So if you want to send to this specific client use
... first read all with Socket->ReceiveBuf()
.. now send
Socket->SendBuf ( ... );
}
If you loop through the Connectiones[] array from 0 to
ServerSocket->Socket->ActiveConnectios - 1 you will find that
one of them has the value Socket.
Hans.
Re: How to know the number of the connection in using serversocket?
Author: Remy Lebeau (TeamB)
Date: Thu, 12 May 2005 20:43
Date: Thu, 12 May 2005 20:43
14 lines
1437 bytes
1437 bytes
"Didier" <bodinier.didier@wanadoo.fr> wrote in message news:4283b3c9@newsgroups.borland.com... > I 'm getting the informations transmitted by the method OClientRead > (Socket.ReceiveBuf etc...); > Now I 'd like to send an ack to the machine ;so I want to use > Socket->Connections[x]->SendText etc.. If you are sending the ack from inside the OnClientRead event, then use the same Socket parameter that you read your data from. Gambit
Thread Navigation
This is a paginated view of messages in the thread with full content displayed inline.
Messages are displayed in chronological order, with the original post highlighted in green.
Use pagination controls to navigate through all messages in large threads.
Back to All Threads