Sending UDP packets with fixed source port
Posted on October 26, 2007 - Filed Under Ruby
If you're new here, you may want to subscribe to my RSS feed. You can also get updates by email Thanks for visiting!
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: 3827
Similar Posts
- EventMachine – how to get client’s IP address
- How to start debug Ruby programs?
- Monitoring FreeBSDs ports
- Ruby Tk
- TLabel – simple, smaller labels on Google Maps
Comments
Leave a Reply


