Welcome to the Cumulus Support forum.

Latest Cumulus MX V3 release 3.28.6 (build 3283) - 21 March 2024

Cumulus MX V4 beta test release 4.0.0 (build 4018) - 28 March 2024

Legacy Cumulus 1 release v1.9.4 (build 1099) - 28 November 2014 (a patch is available for 1.9.4 build 1099 that extends the date range of drop-down menus to 2030)

Download the Software (Cumulus MX / Cumulus 1 and other related items) from the Wiki

System.Net.Sockets.SocketException fix

Topics about the Beta trials up to Build 3043, the last build by Cumulus's founder Steve Loft. It was by this time way out of Beta but Steve wanted to keep it that way until he made a decision on his and Cumulus's future.

Moderator: mcrossley

Locked
posixx
Posts: 4
Joined: Thu 05 Jan 2017 7:31 pm
Weather Station: Davis Vatage Pro2
Operating System: Windows 10

System.Net.Sockets.SocketException fix

Post by posixx »

Hello Steve,

Currently i'm running cumulusmx connected to a Davis VantagePro2 through the weatherenvoy with IP Datalogger. CumuluxMX is very stable; the only problem i have is that sometimes (random periods, can work for several days, but can also happen within the hour) i get a socketexception as displayed below:

2017-04-24 18:20:47.533 !!! loop data not received
2017-04-24 18:20:48.554 System.IO.IOException: Unable to write data to the transport connection: An existing connection was forcibly closed by the remote host. ---> System.Net.Sockets.SocketException: An existing connection was forcibly closed by the remote host
at System.Net.Sockets.Socket.Send(Byte[] buffer, Int32 offset, Int32 size, SocketFlags socketFlags)
at System.Net.Sockets.NetworkStream.Write(Byte[] buffer, Int32 offset, Int32 size)
--- End of inner exception stack trace ---
at System.Net.Sockets.NetworkStream.Write(Byte[] buffer, Int32 offset, Int32 size)
at CumulusMX.DavisStation.SendLoopCommand(TcpClient tcpPort, String commandString) in C:\Users\steve\Documents\Visual Studio 2015\Projects\CumulusMX\CumulusMX\DavisStation.cs:line 766
at CumulusMX.DavisStation.Start() in C:\Users\steve\Documents\Visual Studio 2015\Projects\CumulusMX\CumulusMX\DavisStation.cs:line 575
at System.Threading.ThreadHelper.ThreadStart_Context(Object state)
at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
at System.Threading.ThreadHelper.ThreadStart()

When i restart CumulusMX manually it will connect again succesfully. The reason for the disconnected are most probably because currently the IP datalogger is connected trhough a VPN to the CumulusMX PC, and there can be a hickup once in a while. But i think this problem can be solved easily by modifying your try / catch block within DaviStation.cs, catching the System.IO.IOException specifically and restart the data loop / thread from there. I would add a configurable retry maximum so it's not constantly restarting the loop if the connection is lost for some reason.

Would this be something you are willing to add to the source? Currently i have to monitor the interface often to see it the station is still connected. The above addition would make cumulus a lot more stable for these IP-connected scenario's.

Regards,

Frans
User avatar
steve
Cumulus Author
Posts: 26702
Joined: Mon 02 Jun 2008 6:49 pm
Weather Station: None
Operating System: None
Location: Vienne, France
Contact:

Re: System.Net.Sockets.SocketException fix

Post by steve »

See various other threads where a few people have the same problem with their system. It's on the to-do list, hopefully in the next build, but I can't say when that will be.
Steve
posixx
Posts: 4
Joined: Thu 05 Jan 2017 7:31 pm
Weather Station: Davis Vatage Pro2
Operating System: Windows 10

Re: System.Net.Sockets.SocketException fix

Post by posixx »

Steve,

Sorry i didn't find the problem in other threads otherwise i would post to these. Good to hear it's on the to-do list. If you need any help let me know i'm i .NET developer myself.

Frans
richard_newberry
Posts: 481
Joined: Tue 12 Apr 2011 10:23 pm
Weather Station: Watson W-8186
Operating System: Raspbian Bookworm & Debian 12
Location: Leicester
Contact:

Re: System.Net.Sockets.SocketException fix

Post by richard_newberry »

I'll hold you to that mate. find out why mono 4.6.2 don't work on cumulus.

debian stretch is nearly released and mono 4.6.2 comes with it as default.

Cheers
Desford Weather (at parents)
https://desford-weather.co.uk

Countesthorpe Weather (at mine)
https://countesthorpe-weather.co.uk
Locked