Recent

Author Topic: TCP connections by lNet or else  (Read 5104 times)

skaner1900

  • Jr. Member
  • **
  • Posts: 59
TCP connections by lNet or else
« on: March 25, 2011, 04:47:14 pm »
When I connected 3 or more applications by lNet (TCP), all messages, recived by all application. How send message to only one receiver, and how recognize who send which message?

Almindor

  • Sr. Member
  • ****
  • Posts: 412
    • http://www.astarot.tk
Re: TCP connections by lNet or else
« Reply #1 on: March 26, 2011, 01:48:23 pm »
All events have aSocket: TLSocket parameter.

So for example if you accept a new connection from a client, you get OnAccept(aSocket: TLSocket) called (if you assigned the event).

You can store this aSocket to a list (or whatever you need) and you can also use aSocket.UserData to store your own information "to" a socket.

When sending back, use TLTCP.SendMessage('what', Socket); where Socket is the TLSocket belonging the connected client you need.

How to store and identify these sockets is up to you and your needs.

 

TinyPortal © 2005-2018