You can't detect it with your present code, because all your present server does is send one message to a newly accepted connection, which isn't likely to fail, and then completely forget about that connection., including leaking its socket into hyperspace.
You need to either start a new thread per connection, that will deal with all I/O on that connection including disconnects (signaled by recv() returning zero) or errors (signaled by -1 returns from send() or recv())., or else go to Async or multiplexed I/O, which is two whole nuther kettles of fish.