create tcp socket and connect to stdin/out