Updated Client program: create_socket #function to establish connection with server print $sock, ; sleep(1); #to allow a pause so that username and pwd are 2 streams print $sock ; while($len = sysread($sock, $buffer, 500000000)) { createFile("", $buffer, $len, 0); #processFile; }