1994 1995 1996 1997 1998 1999 2000 2001 2002 2003 2004 2005 2006 2007 2008 2009 2010 2011 2012 <2013> 2014 2015 2016 2017 2018 2019 2020 2021 2022 2023 2024 | Index | 1994 1995 1996 1997 1998 1999 2000 2001 2002 2003 2004 2005 2006 2007 2008 2009 2010 2011 2012 <2013> 2014 2015 2016 2017 2018 2019 2020 2021 2022 2023 2024 |
<== Date ==> | <== Thread ==> |
---|
Subject: | iocLogServer connection problem on win32-x86 platform |
From: | "Janez Golob" <[email protected]> |
To: | <[email protected]> |
Date: | Tue, 4 Jun 2013 15:42:30 +0200 |
Hi All, I am running iocLogServer on the win32-x86 platform (base 3.14.12, VS 2010 Express). If the connection to the log server is inactive for more than 90 second (more precisely, if there are no messages logged) the following error is reported by the IOC (IOC log client): epics> log client: lost contact with log server at "127.0.0.1:7111" because "An existing connection was forcibly closed by the remote host. " I was digging a bit in to the iocLogServer.c source code and it seems to me the following statement causes the problem: 494 status = shutdown(pclient->insock, SHUT_WR); It seems to me that shutting down one half of the connection can also close the opposite half. On the socket level the below two short python programs can be used to reproduce the behavior. What is the reason for using half-duplex connection only? To my experience the shutdown function is used to close the connection gracefully. Regards, Janez Server side: import socket HOST = '' PORT = 50007 s = socket.socket(socket.AF_INET, socket.SOCK_STREAM) s.bind((HOST, PORT)) s.listen(1) conn, addr = s.accept() print 'Connected by', addr conn.shutdown(socket.SHUT_WR) while 1: data = ""> if not data: break print '"{}"'.format(data) conn.close() Client side: import socket import time HOST = 'localhost' PORT = 50007 s = socket.socket(socket.AF_INET, socket.SOCK_STREAM) s.connect((HOST, PORT)) s.send('This should succeed') time.sleep(100) s.send('This shuld fail') |