aims Posted July 28, 2015 Share Posted July 28, 2015 I using VSE C# to develop a winform application. What i want to do is stop the application to read the motor status, speed and position when communication is lost. I simulate it by unplug the com cable. The error is "The server threw an exception. (Exception from HRESULT: 0x80010105 (RPC_E_SERVERFAULT))". How do I clear the COM object. Please advice what is the right method to detect the com lost and stop my application. Link to comment Share on other sites More sharing options...
steve.milici Posted July 28, 2015 Share Posted July 28, 2015 What OS and what is the version of Pcommserver? Link to comment Share on other sites More sharing options...
aims Posted July 29, 2015 Author Share Posted July 29, 2015 What OS and what is the version of Pcommserver? window XP and Pcommserver 4.3.3.0. Link to comment Share on other sites More sharing options...
steve.milici Posted July 29, 2015 Share Posted July 29, 2015 Close the PMAC device and kill the server - then restart. Link to comment Share on other sites More sharing options...
aims Posted July 30, 2015 Author Share Posted July 30, 2015 May I know what you mean by saying "restart"??? restart to Pcommserver.exe process or restart the PC??? After the exception error happen, my application become lag and slow. I cant get the motor status but the method getresponcex() is still working but it slow to response a bit. For this moment, what i notice is when I am using the PEWIN32 PRO to communicate with PMAC turbo and after that, I am run my C# application again, everthings work smoothly. Any idea? Link to comment Share on other sites More sharing options...
aims Posted July 30, 2015 Author Share Posted July 30, 2015 I think it the problem is on my application code. Link to comment Share on other sites More sharing options...
steve.milici Posted July 30, 2015 Share Posted July 30, 2015 Restart the server and then re open your PMAC device. Link to comment Share on other sites More sharing options...
Unit101 Posted August 11, 2015 Share Posted August 11, 2015 To reset your comms with the PMAC I do this: HERE call pcomm function to close the connection public static void CloseDevice() { try { if (DeviceNum > -1) Pmac.Close(DeviceNum); Online = false; } catch { Online = false; } } Here go to windows and kill the pcommserver process string processName = "PcommServer"; foreach (Process proc in Process.GetProcessesByName(processName)) { proc.Kill(); } Let me know if you need more help with this... I have written a lot of code that will detect when the PMAC connection is lost and make attempts to restore. Link to comment Share on other sites More sharing options...
Recommended Posts