Argonne National Laboratory

Experimental Physics and
Industrial Control System

1994  1995  1996  1997  1998  1999  2000  2001  2002  2003  2004  2005  2006  2007  2008  2009  2010  2011  2012  <20132014  2015  2016  2017  2018  Index 1994  1995  1996  1997  1998  1999  2000  2001  2002  2003  2004  2005  2006  2007  2008  2009  2010  2011  2012  <20132014  2015  2016  2017  2018 
<== Date ==> <== Thread ==>

Subject: iocLogServer connection problem on win32-x86 platform
From: "Janez Golob" <janez.golob@cosylab.com>
To: <tech-talk@aps.anl.gov>
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')


Replies:
RE: iocLogServer connection problem on win32-x86 platform Hill, Jeff

Navigate by Date:
Prev: Re: SEQ with dynamic assignment of PV in array variable Benjamin Franksen
Next: Re: SEQ with dynamic assignment of PV in array variable Benjamin Franksen
Index: 1994  1995  1996  1997  1998  1999  2000  2001  2002  2003  2004  2005  2006  2007  2008  2009  2010  2011  2012  <20132014  2015  2016  2017  2018 
Navigate by Thread:
Prev: Re:RE: IP330 modules question 문건영
Next: RE: iocLogServer connection problem on win32-x86 platform Hill, Jeff
Index: 1994  1995  1996  1997  1998  1999  2000  2001  2002  2003  2004  2005  2006  2007  2008  2009  2010  2011  2012  <20132014  2015  2016  2017  2018 
ANJ, 20 Apr 2015 Valid HTML 4.01! · Home · News · About · Base · Modules · Extensions · Distributions · Download ·
· Search · EPICS V4 · IRMIS · Talk · Bugs · Documents · Links · Licensing ·