NetManiac

Witold Rugowski on web20 wave with Ruby on Rails

Sending UDP packets with fixed source port

Posted on October 26, 2007 - Filed Under Ruby

I needed to send UDP packets from my Ruby application, with fixed source port, but not in response to other packets. Well it turned out You need create UDP server, and then send packets:

s=UDPSocket.new
s.bind('192.168.248.128',5000)
ar = [1000,24,12,3,100,1]
s.send(ar.pack("L6"), 0, "192.168.248.1", 5000)

That’s it!

Popularity: 4% [?]

Hits for this post: 4032

Similar Posts

Comments

Leave a Reply