jdubb@bucsf.bu.edu (jay dubb) (04/24/91)
I am posting this for a friend of mine who doesn't have access to USENET, so please respond directly to mlevin@jade.tufts.edu. Is it possible to use dup() to assign a socket to be the input *and* the output of a process? I did this (to a process which uses the stdio functions like gets(), etc.), in the hopes of then using select() in another program to know when this process wants to read and when it wants to write. The reading works fine, especially when the other process does no input. If the other process does read()s, it works also. But if it uses gets(), it doesn't work (it hangs, etc.). select() also thinks the connection is writable, even though the stuff that the other process printf()ed before it issued the gets() hasn't been seen on the other end yet. My question is: what am I missing? What should I know about the stdio functions when they've been dup()ed to a socket? What is the right way to write EOF to such a process? Will this work, in general, or do I need two separate sockets, one for input and one for output? Any help will be greatly appreciated. Mike Levin (mlevin@jade.tufts.edu)