in reply to getppid is broken in Win?
As questor has pointed out, getppid() is not implemented on Win32 because it is one (of many) built-ins in Perl that display Perl's origins on unix and unix-like systems that do not translate directly or easily onto Win32.
It is usually possible on modern (NT 5 and later) to obtain the information, parent process id, that you are seeking, but it would not help you in this case as when using fork on Win32, as there is only one process.
This is because fork on Win32 is only an emulation that uses a thread to simulate that *nix concept. Therefore, there is only one process containing two threads, with the "process ID" of the child actually being it's negated thread id. This, and several other fundamental differences in the concepts and implementation between Win32 and teh unix-like systems upon which Perl evolved point to a much deeper problem in your stated goal.
Attempting to learn "network programming" using Perl on Win32 is really not a practical idea. This is especially true if you are using one or more of the more common "Perl & Network programming" reference texts which are mostly based firmly upon unix/POSIX programming concepts and techniques. There are too many common programming practices used within these texts--forking, signals, zombies et al--that do not translate to Win32 for this to be a productive learning exercise.
If your primary goal is to learn Perl on Win32, avoid network programming until you are much more familiar with Perl.
If your aim is to become familiar with Network programming in Perl, if you have the choice, look to using a unix-like OS for your learning.
If you want to learn network programming on Win32, avoid reference texts for "Perl & Network programming" and seek out something like Win32 Network Programming: Windows(R) 95 and Windows NT Network Programming Using MFC. This is C++ based, but will tell you much more what is possible and what techniques make sense on Win32.
|
|---|