From: Philippe Chotard Date: 2009-05-09T17:03:59+09:00 Subject: Re: File over tcp? with out using net/ftp Bigmac Turdsplash wrote: > I have been doing a lot of google'n trying to find example code for > sending files threw the socket... I would really like to see some > exmaple code for the client and server... im clueless... Hi Bigmac, here is a simple exemple you can begin with. * Client (sends the file) : require 'socket' file = File.new('file.jpg') fileContent = file.read sock = TCPSocket.open('localhost', 2000) sock.print fileContent sock.close * Server (receives the file) : require 'socket' sock = TCPServer.open(2000) con = sock.accept msg = con.read destFile = File.new('file-received.jpg', 'w') destFile.print msg destFile.close Have fun ChoBolT -- Posted via http://www.ruby-forum.com/.