networking - Detect TCP connection/disconnection in Delphi -
my application has server form includes stringgrid. server allows 4 clients connected @ once. add tcp connections client-side while list not full.
when new client requests tcp connection server , list full, server should check clients in list see if still connected. if clients still connected , list full, reject new client. if 1 or more clients no longer connected, accept new client, add list , update list.
how know clients still connect or not?
you should not checking dead clients @ time when new client wants connect. should set server's maxconnections
property 4 prevent new connections while list full regardless of state of already-connected clients, , check dead clients periodically while connected using protocol-level heartbeats or tcp-level keepalives. if heartbeat/keepalive errors or times out, disconnect client , remove list, allowing new client connect.
Comments
Post a Comment