# \[NETOS\]

**URL:** <https://forums.digi.com/t/netos/5750>\
**Category:** NET+OS\
**Created:** [June 21, 2004, 8:24am UTC](https://forums.digi.com/t/netos/5750 "2004-06-21T08:24:13Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![pbabin](https://avatars.discourse-cdn.com/v4/letter/p/85f322/32.png) [@pbabin](https://forums.digi.com/u/pbabin)\
**Post date:** [June 21, 2004, 8:24am UTC](https://forums.digi.com/t/netos/5750/1 "2004-06-21T08:24:13Z")

</div>

Hi,I work with TCP sockets (server side) and I have a problem with client disconnection : the server keeps its connection alive even if the client has closed port ! Could you help me ? Thanks, Pascal

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/flex016/uploads/digi/original/1X/11da31a6a1fbcd03ef21d3f785c317c824009ae2.png) [@system](https://forums.digi.com/u/system)\
**Post date:** [June 25, 2004, 6:52pm UTC](https://forums.digi.com/t/netos/5750/2 "2004-06-25T18:52:04Z")

</div>

When you make a recv from that socket, it will not block, the recv will return with length equal 0 and that means the peer socket was closed. In practice, I found (on ConnectME) that it may return an error code. More, on multiple connects/disconnects, the code changes after first disconnect. It behaves different when I have a client written in Java, compare with a client written in VisualC++. Try to check what code do you get when disconnecting and use it to detect disconnection. Adrian
