BorlandTalk.com Forum Index BorlandTalk.com
Borland discussion newsgroups
 
Archives   FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

How to know the number of the connection in using serversock

 
Post new topic   Reply to topic    BorlandTalk.com Forum Index -> C++ Builder (Internet Socket)
View previous topic :: View next topic  
Author Message
Didier
Guest





PostPosted: Thu May 12, 2005 7:50 pm    Post subject: How to know the number of the connection in using serversock Reply with quote



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


Back to top
Hans Galema
Guest





PostPosted: Thu May 12, 2005 7:55 pm    Post subject: Re: How to know the number of the connection in using server Reply with quote



Didier wrote:

Quote:
(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.

Back to top
Remy Lebeau (TeamB)
Guest





PostPosted: Thu May 12, 2005 8:43 pm    Post subject: Re: How to know the number of the connection in using server Reply with quote




"Didier" <bodinier.didier (AT) wanadoo (DOT) fr> wrote


Quote:
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



Back to top
Display posts from previous:   
Post new topic   Reply to topic    BorlandTalk.com Forum Index -> C++ Builder (Internet Socket) All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2006 phpBB Group
SEO toolkit © 2004-2006 webmedic.