Recent

Author Topic: using of lNet  (Read 7149 times)

skaner1900

  • Jr. Member
  • **
  • Posts: 59
using of lNet
« on: April 03, 2011, 08:35:56 pm »
Hi.
Examples for lNet are very poor, so maybe somebody know how (TCP/IP):
1. Accept or reject connection (server)
2. Send message to only one user (server and client)
3. Check, who sent message which we are receiving (server and client)
4. Secure application by intercept messages by unauthorized person
Thanks

Dibo

  • Hero Member
  • *****
  • Posts: 1057
Re: using of lNet
« Reply #1 on: April 03, 2011, 08:45:20 pm »
I am using lHTTP component only but sender is in aSocket param:
Code: Pascal  [Select][+][-]
  1. procedure TFormMain.LTCPComponentReceive(aSocket: TLSocket);
  2. begin
  3.   aSocket.SendMessage('Reply to sender');
  4. end;  
  5.  

Leledumbo

  • Hero Member
  • *****
  • Posts: 8835
  • Programming + Glam Metal + Tae Kwon Do = Me
Re: using of lNet
« Reply #2 on: April 03, 2011, 08:59:58 pm »
Quote
Examples for lNet are very poor
Really? They're very good to me. What makes you think so?

For questions below, drop TLTCPComponent to your form first.
Quote
1. Accept or reject connection (server)
Call Listen method to host an address, then handle OnAccept. You can check PeerAddress/PeerPort to determine whether to accept or reject, if you do nothing it will default to Accept() (because it's already accepted). Use Disconnect() to reject.
Quote
2. Send message to only one user (server and client)
TLTCPComponent can act as both server and client. First Connect() to target (in this case, we don't care whether it's client or server), then use Send() or SendMessage() to send the message.
Quote
3. Check, who sent message which we are receiving (server and client)
See answer for question no. 1
Quote
4. Secure application by intercept messages by unauthorized person
Same as above.

Almindor

  • Sr. Member
  • ****
  • Posts: 412
    • http://www.astarot.tk
Re: using of lNet
« Reply #3 on: April 03, 2011, 11:38:20 pm »
Hi.
Examples for lNet are very poor, so maybe somebody know how (TCP/IP):
1. Accept or reject connection (server)
2. Send message to only one user (server and client)
3. Check, who sent message which we are receiving (server and client)
4. Secure application by intercept messages by unauthorized person
Thanks

You're always welcome to submit patches or new example demoes to lNet. It's true that none of your questions are directly answered by an example, but I think the demoes in combination with the documentation should suffice to explain what needs to be done.

Also, your "authentication" (point 4) use case is specific and needs to be handled by the user/application, not lNet. Leledumbo answered all the questions nicely, so I won't repeat it.

 

TinyPortal © 2005-2018