Hey,

I have a simple question. How does the shell (cmd.exe) get bound to a port (ie. how does stdin/stdout get routed through a TCP ip connection).

I guess another way of asking this is how netcat is able to execute cmd.exe and bind it to a port, i dont understand how calling cmd from an app that uses sockets makes cmd take commands from sockets and whatnot.

I have read the sourcecode to netcat, but i'm quite overwhelmed it's really messy.

Any help would be great,
Thanks

EDIT:

I'm talking about WinNT - Win2K - Win XP - Win2k3
(not linux/unix)