[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Computer] Question about NT




 Cha`o ca'c ba'c, ba'c na`o co' chu't kinh nghie^.m ve^` WindowNT cho em
ho?i ca'i na`y :

 - I'm trying to port a server program from Unix to WinNT.
 - In Unix, upon receiving a request, the server can fork itself, pass
the socket to the child to handle the request, and the server return to
listen mode, keep listening to the port.

 _ I'm trying to do the same thing in WinNT, but I don't know how to pass
the socket to the child process. It would be easy to create a new thread,
so we don't have to pass anything, but I'm porting a program, I don't
dare to change the whole program from MultiProcessing to MultiThreading,
which would take too much time.

 - In my understanding, the parent process in WinNT can duplicate and
let the child inherit whatever handle it wants to, but a socket has type
SOCKET, which is not a handle.

 - In fact, CreateProcess() in winNT is like a fork() then exec() in
unix, the child can only inherit certain things, which is quite limited.

 - In summary, I don't know how to pass an open socket to a child
process. Could anybody help me with this.

 Thanks a lot in advance.

 Hu*ng Q. Ngo^