I have a socket and it is connected with a client. I need to be able to pass the socket's handle as a command line argument to another .NET application and have it instantiate that socket to it can communicate with the remote computer.
For Example.
On the other end when the process is started
I need to somehow get the variable client to instantiate from the ptr pointer. Is this possible? Is there another way of doing this?
Thanks
Akusei
For Example.
Code:
CODE FROM SERVER
private void NewConnection(Socket client)
{
Process p = new Process();
p.StartInfo.Filename = "whatever.exe";
p.StartInfo.Arguments = client.Handle.ToInt64().ToString();
p.Start();
p.Close();
p.Dispose();
}
On the other end when the process is started
Code:
CODE FROM WHATEVER.EXE
main(char[] args)
{
IntPtr ptr = new IntPtr(Convert.ToInt64(args[1]));
Socket client = HERE IS WERE I NEED HELP!!!
}
I need to somehow get the variable client to instantiate from the ptr pointer. Is this possible? Is there another way of doing this?
Thanks
Akusei