Hi,
I have had a good working OC4BA_XP app that interfaces Opencockpits modules witht XPLANE11 B737 airplanes when the SIOC.exe was in version 5
Using the new SIOC v6 do not work. AS I do not know what changes there have been made between v5 to v6 of SIOC it is hard to debug.
This is the fault message I get from the debugger:
System.IO.IOException occurred
HResult=0x80131620
Message=Unable to read data from the transport connection: An existing connection was forcibly closed by the remote host.
Source=<Cannot evaluate the exception source>
StackTrace:
at System.Net.Sockets.NetworkStream.Read(Byte[] buffer, Int32 offset, Int32 size)
at DotNetDataRefConnector.SIOCinterface.SIOCListenThread()
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()
Inner Exception 1:
SocketException: An existing connection was forcibly closed by the remote host
This is the code part where the problem is located to:
public bool SIOCConnect()
{
string ServerIP = "Localhost";
//string[] Lines = System.IO.File.ReadAllLines("g:\\SIOC\\SIOC.ini"

;
string[] Lines = System.IO.File.ReadAllLines(@"SIOC.ini"

;
//string ServerPort = "8092";
string ServerPort = (Lines[1].Substring(10, 4));
SiocConnectionState = (int)Connection.trying; // trying
//RefreshControlWindow();
try
{
/* Connecting to server (will crash if address/name is incorrect) */
//
TCPClient = new TcpClient(ServerIP, Int32.Parse(ServerPort));
//
SiocConnectionState = (int)Connection.connected; //Connected
//RefreshControlWindow();
/* Store the NetworkStream */
NetworkStream = TCPClient.GetStream();
/* Create data buffer */
NetworkBuffer = new byte[TCPClient.ReceiveBufferSize];
// Create listening thread and assign it to ListenThread()
Thread SIOCListenTread = new Thread(new ThreadStart(SIOCListenThread));
// Now start listening to incomming message from SIOC
SIOCListenTread.Start();
//
SiocConnectionState = (int)Connection.connected; /*RefreshControlWindow();*/
//WeAreClosing = false;
SendInicio(); // Send Inicio String to SIOC so it knows what variables we need
return true;
}
catch
{
SiocConnectionState = (int)Connection.failed; /*RefreshControlWindow();*/
return false;
}
}