Skip to content

Instantly share code, notes, and snippets.

@akshay-bhardwaj
Created November 17, 2014 20:33
Show Gist options
  • Save akshay-bhardwaj/210559f9d9cc9909b2dc to your computer and use it in GitHub Desktop.
Save akshay-bhardwaj/210559f9d9cc9909b2dc to your computer and use it in GitHub Desktop.
require 'socket'
sk = TCPSocket.new("localhost", "1080")
fp = File.open("readin.txt")
fp.each_line do |line|
to_write = "#{line}\n".force_encoding("utf-8")
sk.write(to_write)
puts to_write
end
fp.close()
sk.close()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment