Is it possible to pass a Socket.Handle from a C# Application to a ASP.NET Web Application running on the same server?
I have looked around and found examples of passing C# socket to un-managed code, however this is not sufficient.
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
I’m very curious about why you’d want to do that.
As for the answer, no, I am 99% sure it is not possible, because unless I am very much mistaken socket handles are scoped to the process at the OS level.
EDIT:
Based on the comments, it sounds like you’d want to make the server process run a WCF service on IPC transport that the ASP.NET application can use to pass along commands to the hardware.
An added benefit is that if you use WCF and eventually need to move the ASP.NET site to another box, you can switch to TCP transport with relatively little fuss.