from socket to file