Off-Topic > Off-Topic - Tiny Core Lounge
tc to support raw socket?
(1/1)
TTT:
good day,
i test tinycore and want to use raw socket.
but seems it donest support raw socket.
anyone know to how to use raw socket for tinycore?
thanks in advance.
Rich:
Hi TTT
Welcome to the forum.
--- Quote from: TTT on February 24, 2020, 08:37:17 PM --- ... but seems it donest support raw socket. ...
--- End quote ---
I don't know why you would think that. This is how I set up a raw socket:
--- Code: ---/******************************************************************/
/* Configures the socket for the Sniffer routine */
static void SetupRawSockets(void)
{
sniffersock=socket(AF_PACKET, SOCK_RAW, htons(ETH_P_ALL));
fcntl(sniffersock, F_SETFL, fcntl(sniffersock, F_GETFL) | O_NONBLOCK);
return;
}
/******************************************************************/
--- End code ---
sniffersock is defined as an int.
You can find the source code it came from here:
http://forum.tinycorelinux.net/index.php/topic,22646.msg141958.html#msg141958
TTT:
thanks so much. i solve my problem now. ;)
Rich:
Hi TTT
--- Quote from: TTT on February 25, 2020, 07:02:03 AM ---thanks so much. ...
--- End quote ---
You are welcome.
If you are new to network programming, this is worth checking out. It doesn't cover raw sockets, but it's easy to understand and
covers important concepts. It also has coding samples:
http://beej.us/guide/bgnet/
Raw sockets means you will likely be packing data structures. This large site covers many protocols and the data layout of
their respective packets:
http://www.tcpipguide.com/free/index.htm
Navigation
[0] Message Index
Go to full version