This project has moved and is read-only. For the latest updates, please go here.

Cannot open TCP port in OutputAdapter

Apr 5, 2011 at 9:00 PM

I just tried to create an output adapter that uses the DataPublisher to send data to a custom client.

Regardless of which port I specify I get an error:

Exception Source:      System
Exception Type:        System.Net.Sockets.SocketException
Exception Message:     Only one usage of each socket address (protocol/network address/port) is normally permitted
Exception Target Site: DoBind

---- Stack Trace ----
   System.Net.Sockets.Socket.DoBind(endPointSnapshot As EndPoint, socketAddress As SocketAddress)
       openPDC.exe: N 6124374
   System.Net.Sockets.Socket.Bind(localEP As EndPoint)
       openPDC.exe: N 00209
   TVA.Communication.Transport.CreateSocket(address As String, port As Int32, protocol As ProtocolType)
       openPDC.exe: N 00143
   TVA.Communication.TcpServer.Start()
       openPDC.exe: N 00109
   TimeSeriesFramework.Transport.DataPublisher.Start()
       openPDC.exe: N 00103
   TSFAdapterLibrary.CustomOutputAdapters.StartPublisher()
       openPDC.exe: N 00165
   TSFAdapterLibrary.CustomOutputAdapters.AttemptConnection()
       openPDC.exe: N 00178
   TimeSeriesFramework.Adapters.OutputAdapterBase.m_connectionTimer_Elapsed(sender As Object, e As ElapsedEventArgs)
       openPDC.exe: N 00121

When I run the output adapter within a test harness, outside of the openPDC service, it lets me open up the port I have requested.
Can you tell me the correct way to export data from an output adapter over TCP?

Thanks,
Steve

Apr 7, 2011 at 12:54 PM

Are you sure that the port is not in use by the openPDC service? Run "netstat -a" from the command prompt to view ports in use.

Apr 7, 2011 at 3:33 PM

Yes I'm quite sure.

I've tried a variety of ports and typically use 8600 - TcpView does not show this as being used.

I can successfully wrap the TCPServer object in the output adapter, and use this to do simple messaging on port 8600 - when I try to use the DataPubliser object it refuses to open the port.

Steve

Apr 8, 2011 at 8:20 PM

Is the openPDC service running? By default the DataPublisher runs on port 6165, this can be changed - but if the openPDC is running and occupying this port you will get this error...

Ritchie