spam wed apr : : spam wed apr : : spam the net effect is that - still works around the steam buffering issue for connected programs in xas long as you don' reset the streams to other objects in the spawned program as we did for socket redirection in example - for socket redirectionsmanual flush calls or replacement socket wrappers may be required sockets versus command pipes so why use sockets in this redirection role at allin shortfor server independence and networked use cases notice how for command pipes it' not clear who should be called "serverand "client,since neither script runs perpetually in factthis is one of the major downsides of using command pipes like this instead of sockets--because the programs require direct spawning relationshipcommand pipes do not support longerlived or remotely running servers the way that sockets do with socketswe can start client and server independentlyand the server may continue running perpetually to serve multiple clients (albeit with some changes to our utility module' listener initialization codemoreoverpassing in remote machine names to our socket redirection tools would allow client to connect to server running on completely different machine as we learned in named pipes (fifosaccessed with the open call support stronger independence of client and servertoobut unlike socketsthey are usually limited to the local machineand are not supported on all platforms experiment with this code on your own for more insight also try changing example - to run the client function in spawned process instead of or in addition to the serverwith and without flush calls and time sleep calls to defer exitsthe spawning structure might have some impact on the soundness of given socket dialog structure as wellwhich we'll finesse here in the interest of space despite the care that must be taken with text encodings and stream bufferingthe utility provided by example - is still arguably impressive--prints and input calls are routed over network or local-machine socket connections in largely automatic fashionand with minimal changes to the nonsocket code that uses the module in many casesthe technique can extend script' applicability in the next sectionwe'll use the makefile method again to wrap the socket in filelike objectso that it can be read by lines using normal text-file method calls and techniques this isn' strictly required in the example--we could read lines as byte strings with the socket recv calltoo in generalthoughthe makefile method comes in handy any time you wish to treat sockets as though they were simple files to see this at worklet' move on making sockets look like files and streams