Never been to DZone Snippets before?

Snippets is a public source code repository. Easily build up your personal collection of code snippets, categorize them with tags / keywords, and share them with the world

messenger de linha de comando em ruby (See related posts)

#!/usr/bin/ruby

require "socket"

porta = 14143

server = UDPSocket.new
server.bind("208.97.177.80", porta)

t = Thread.new do
	loop do
		msg, sender = server.recvfrom(256)
		host = sender[3]
		puts#{host} diz: #{msg}”
		break unless msg.chomp !=falow..”
	end
end

cliente = UDPSocket.open
cliente.connect(”201.58.157.200″, porta)
loop do
	msg = gets
	cliente.send(msg, 0)
	break unless !kill, quit, bye!, falow..” . include? msg.chomp
end
cliente.close

You need to create an account or log in to post comments to this site.


Click here to browse all 6639 code snippets

Related Posts