Skip to content

Commit

Permalink
Fixed closing connection, suggested by Derriick
Browse files Browse the repository at this point in the history
  • Loading branch information
dmroeder committed May 28, 2019
1 parent 31cf687 commit 4763679
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 7 deletions.
3 changes: 3 additions & 0 deletions changelog
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
05/28/19
-Fixed closing socket, suggested by Derriick

05/05/19
-Pulled extneded forward open support from aansel-plenty
-Did a little code cleaup
Expand Down
13 changes: 6 additions & 7 deletions pylogix/eip.py
Original file line number Diff line number Diff line change
Expand Up @@ -807,18 +807,17 @@ def _closeConnection(self):
Close the connection to the PLC (forward close, unregister session)
'''
self.SocketConnected = False
closePacket = _buildForwardClosePacket(self)
unregPacket = _buildUnregisterSession(self)
close_packet = _buildForwardClosePacket(self)
unreg_packet = _buildUnregisterSession(self)
try:
self.Socket.send(closePacket)
retData = recv_data(self)
self.Socket.send(unregPacket)
retData = recv_data(self)
self.Socket.send(close_packet)
self.Socket.send(unreg_packet)
self.Socket.close()
except:
self.Socket.close()
finally:
pass


def _getBytes(self, data):
'''
Sends data and gets the return data
Expand Down

0 comments on commit 4763679

Please sign in to comment.