Recent

Author Topic: problem with recognizing sockets  (Read 3875 times)

skaner1900

  • Jr. Member
  • **
  • Posts: 59
problem with recognizing sockets
« on: November 27, 2011, 11:06:55 pm »
I've got a problem with sending & receiving messages from host to a determined client because lnet identifies him basing on his socket number nad this number is not fixed but changable and changes after each new client log-in.

how can I send a message to a definied client? How can I recognize clients?

marcov

  • Administrator
  • Hero Member
  • *
  • Posts: 12905
  • FPC developer.
Re: problem with recognizing sockets
« Reply #1 on: November 28, 2011, 10:13:31 am »
I've got a problem with sending & receiving messages from host to a determined client because lnet identifies him basing on his socket number nad this number is not fixed but changable and changes after each new client log-in.

how can I send a message to a definied client? How can I recognize clients?

A simple solution is their IP. A better solution lets the client itself register something unique or even login.

skaner1900

  • Jr. Member
  • **
  • Posts: 59
Re: problem with recognizing sockets
« Reply #2 on: November 28, 2011, 12:15:11 pm »
Primo: more than one client may have the same IP (for example in LAN)

Secondo: SedMessage('babble babble', fnet.Socks[XXX]);
How to send a message using IP? Every connection and disconnection changes XXX, and I don't know who is who.
« Last Edit: November 28, 2011, 12:29:49 pm by skaner1900 »

ludob

  • Hero Member
  • *****
  • Posts: 1173
Re: problem with recognizing sockets
« Reply #3 on: November 28, 2011, 01:24:12 pm »
Quote
Secondo: SedMessage('babble babble', fnet.Socks[XXX]);
How to send a message using IP? Every connection and disconnection changes XXX, and I don't know who is who.
On the socket level that is all you have: a socket. That is basically a local and remote ip address and a local and remote port. If you need more info from the remote, you'll need to associate the socket with info on a higher level: client login, certificate or whatever that can be used to identify a client.

Compare a socket to a telephone connection. When you answer the phone, you know the caller number (could be the number of a switch) and the line you answered. And that's it. You'll need to talk to the other side to know who is your correspondent and, if you have several phone lines, you need to remember somehow who is who on the other side of the different lines.

 

TinyPortal © 2005-2018