#!/usr/bin/env ruby require 'socket' send_msg = ARGV[1] send_msg ||= "[nil msg]" puts "MSG >>>#{send_msg}<<<" port = ARGV[0].to_i puts "PORT >>>#{port}<<<" TCPSocket.open("localhost", port) do |sk| sk.puts send_msg puts "SENT >>>#{send_msg}<<<" recv_msg = sk.gets puts "RECV >>>#{recv_msg.chomp}<<<" end
I am exploring two new languages and a Distributed VCS. Go and Node.js. Go has Goroutines (sorta evented, sorta threaded) and Node.js is intrinsically event driven. Git is a VCS born of Linus Torvalds mind (tried Mercuria[hg] but git has won me and the majority over).
Friday, January 28, 2011
Single line socket puts
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment