[Lazarus] Cross-Compiling
Osvaldo Filho
arquivostcf at gmail.com
Mon Nov 17 12:48:50 CET 2008
On Fri, 14 Nov 2008 17:42:45 +0100
User <usuarioanonimomysql at gmail.com> wrote:
> Hi, I have a client-server program made with lNet and I have several clients
> conected to the server.
>
> The clients send petitions to the server and I want that the response for
> the server is only for the client that has generated the petition.
>
> For example I have three clients and one of them send "Hello" to the server.
>
> When the server receibe "Hello" its responds "How are you?" but I want that
> the server only send "How are you?" to the client whom it has sent "Hello"
> and not for all the clients.
>
> Thanks.
>
> Best regards.
>
More info is required:
Are you using TCP? Then you need to sent to the given TLSocket which was used as argument to your OnReceive, something like
TCP.SendMessage('whatever', aSocket);
Are you using UDP? Then there's only one socket all the time, but you can filter the sends by IP:Port combination. Use aSocket.PeerPort and aSocket.PeerAddress to respond (or build a list of users for example, stringlist works best). Then just do:
UDP.SendMessage('whatever', peer) where "peer" is a string like:
'111.22.33.44:4665' (aSocket.PeerAddress + ':' + aSocket.PeerPort);
--
Aleš Katona <almindor at gmail.com>
More information about the Lazarus
mailing list