Skip to main content

Using Raw Sockets in Asio/Boost.Asio

·123 words·1 min

This past week I got to play with the cross-platform Asio and Boost.Asio C++ libraries for socket programming.

boost.asio y u no inject packets?

Unfortunately it turns out what I was trying to do (inject network packets) is not possible with these libraries, but in the process of trying to get that to work I was able to use the basic_raw_socket template class successfully, which it looks like several  other people on the Internet are having trouble with. So I’ve written up a GitHub repository with the code and a pretty detailed README. I hope it will help others understand how to use raw sockets in Asio better.

kevincon/asio-rawsockets-example

Simple demonstration of using Boost.Asio’s basic_raw_socket template class to transmit packets with a custom transport layer header.

C++
29
12