Author Topic: A connection request was made on an already connected socket  (Read 8670 times)

StephenSDH

  • Newbie
  • *
  • Posts: 36
    • View Profile
A connection request was made on an already connected socket
« on: April 06, 2013, 09:21:24 AM »
Thanks first of all for your open source project.  I am not the most experienced at .NET, and I had no issue getting started.

I used your software to create an interface between SQL server and 10 Micrologix 1100 plcs.  I am using the "EthernetIPforSLCMicroComm" driver.  I added 10 instances of the driver to the main form, one for each PLC.

I am pulling data from sql server and writing to the PLCs on a timed interval using ".WriteData(Address,Value)".  The application works great.  The issue I have is when a PLC is turned off, or if for some other reason communication is lost, the driver won't always reestabilish.  I looked into it and I get the attached error "A connection request was made on an already connected socket".  I appears the error comes from inside the Driver DLL so I'm not sure there is anything more I can do to trouble shoot.  To recreate the error I would disabled/reenabled the network adapter, the comms fail on all the plcs, then when reenabling the adapter usually one station will not reestablish.

Hopefully I detailed the issue.  I downloaded from sourcecode 6 months ago, so I assume the code I have is fairly current.

Thanks,

Steve

Archie

  • Administrator
  • Hero Member
  • *****
  • Posts: 5322
    • View Profile
    • AdvancedHMI
Re: A connection request was made on an already connected socket
« Reply #1 on: April 06, 2013, 10:05:09 AM »
This is a known issue that has been addressed in the next release. When the CIP connection closes, it does not close the corresponding TCP socket.

StephenSDH

  • Newbie
  • *
  • Posts: 36
    • View Profile
Re: A connection request was made on an already connected socket
« Reply #2 on: April 06, 2013, 10:09:35 AM »
Thanks Archie.  I was able to get the communications to reestablish by catching the error and creating a new Dll instance.  It looks like this will work for now.

Thanks for your response,

Steve


     Private Function SendData(ByVal data() As Byte, ByVal MyNode As Byte, ByVal TargetNode As Byte) As Integer
        If DLL Is Nothing Then
            CreateDLLInstance()
        End If

        Try

            Return DLL(MyDLLInstance).ExecutePCCC(data)

        Catch ex As MfgControl.AdvancedHMI.Drivers.Common.PLCDriverException

            DLL(MyDLLInstance) = New MfgControl.AdvancedHMI.Drivers.CIP
            DLL(MyDLLInstance).EIPEncap.IPAddress = m_IPAddress

        End Try

    End Function