We would like to build a community for Small Basic programmers of any age who like to code. Everyone from total beginner to guru is welcome. Click here to register and share your programming journey!


Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Disconnect the Client from the Server
#2
Hi AB,

As a rule I generally think a new thread for a new question is best so I did split this one, but in the end it doesn't really matter of course.

I assume you want a client to inform the server that it is leaving.  To do this the client should call LDClient.Disconnect().  It is hard to know when the client may just end its program, hence the use of LDGraphicsWindow.Closing in one of my client-server examples for a GW based program.  In the case where the client only has a TextWindow which they may close to end the session, there is no equivalent to LDGraphicsWindow.Closing event for the TextWindow in LD extension.

It would be best if the client ended some way using LDClient.Disconnect(), but not essential if the server can cope with it.  We cannot get the client to send LDClient.Disconnect() if a user just kills it by closing TextWindow, but if it is being run by AI then it should end itself nicely with LDClient.Disconnect() when it is done, probably immediately before Program.End() is called.  Also, I assume the rabbit/snake program will be using GW.

In the case where a client can just 'disappear', the server could issue a command to all clients (say once a second) asking if they are still there and if the server gets no reply, then assume the client is gone.
Reply


Messages In This Thread
RE: Disconnect the Client from the Server - by litdev - 05-31-2024, 01:12 PM

Forum Jump:


Users browsing this thread: 2 Guest(s)