in reply to Windows TCP socket client hangs in perlipc code
Your client uses fork which on Win32 is only an emulation that uses threads. The result is that instead of having two separate processes, you have a single process with two threads.
The means that the 'child' thread is in a wait state trying to read from the tcp port. At the same time, the 'parent' thread is trying to write to the same port. This doesn't work, at least not on Win32--YMMV on other platforms. The print will block until the port exits the read wait state, which it won't do until the server sends something. But the server won't send anything until the client succeeds in printing something.
The result is a classic deadlock.
The code was probably written for use on a POSIX platform where a real fork (and signals and...) are available from the OS. Such code does not port directly to Win32.
|
|---|