RAW Sockets lazarus / 38-Networking and Web Programming ---------------------------------------------------------------------- el3ctrolyte · 2020-08-25 23:38 I want to use synapse to make a simple sniffer program but can't seem to get the basic thing working. I am using the TRAWBlockSocket class but can seem to get it it work. Here is my code sample: Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i program project1;uses    blcksock,sysutils;var  sock:TRAWBlockSocket;  mem:array[0..1023] of byte;begin  sock:=TRAWBlockSocket.Create;  sock.Listen; //don't know if this is what i should do, i have tried it without this line and still doesn't work  while true do  begin    sock.RecvBuffer(@mem,1024);    if mem[0] <> $00 then    begin      writeln(IntToHex(mem[0],2));    end;  end;end.  I can't find any example's on the internet about how to use TRAWBlockSocket to sniff packets. Also i am on windows. ---------------------------------------------------------------------- Thaddy · 2020-08-26 07:01 For Windows to work with raw sockets, you need WinPcap to be installed. https://www.winpcap.org/ I wrote a sniffer back in 2004 for the KOL library that also works with FPC (needs KOL library) http://members.chello.nl/t.koning8/kolsniffer.zip Maybe you can steal some of my code (with permission). It at least shows you the requirements. There is no standard support for raw sockets on Windows at the user level. Hence you need a driver like WinPcap. My code is also available from the WinPcap site, but they refer to an old version of KOL. ---------------------------------------------------------------------- el3ctrolyte · 2020-08-26 22:51 Thanks for your reply! I tried the same code in linux and still doesn't work, not even with root privileges. I wish there was some kind of example of how to use TRawBlocksocket for making a sniffer. I would prefer it if i didn't need to leave synapse. I primarily work in linux but just wrote this little piece of code on a windows machine.