I tried server client tcp code in c, I want to add some functionality to disconnect client from server. I search on google for it. I found function shutdown()
, I am not getting idea how to do it ?
Asked
Active
Viewed 9,266 times
-2
-
2by closing the client socket ... – rabi shaw Apr 09 '15 at 09:28
1 Answers
4
To disconnect a client from the server, just close
the fd linked to this client.
To disconnect a client to a server from the client, just close
the client socket.
This is a quick way to disconnect, but don't forget to send a last exit message when you are leaving from a server / disconnecting a client.
No need of shutdown here. (Except if you share fd between processes, but without more information we cannot be more precise)

Aracthor
- 5,757
- 6
- 31
- 59