<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	
	>
<channel>
	<title>
	Comments on: How to Code Raw Sockets in C on Linux	</title>
	<atom:link href="https://www.binarytides.com/raw-sockets-c-code-linux/feed/" rel="self" type="application/rss+xml" />
	<link>https://www.binarytides.com/raw-sockets-c-code-linux/</link>
	<description>News, Technology, Entertainment and more</description>
	<lastBuildDate>Tue, 28 Feb 2023 10:38:22 +0000</lastBuildDate>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	<generator>https://wordpress.org/?v=6.8.2</generator>
	<item>
		<title>
		By: Vladyslav		</title>
		<link>https://www.binarytides.com/raw-sockets-c-code-linux/comment-page-1/#comment-351874</link>

		<dc:creator><![CDATA[Vladyslav]]></dc:creator>
		<pubDate>Tue, 28 Feb 2023 10:38:22 +0000</pubDate>
		<guid isPermaLink="false">http://www.binarytides.com/blog/?p=60#comment-351874</guid>

					<description><![CDATA[Hi, thank you for the great example! 
One question. You use direct mapping of the structures into memory. How do you know that there will be no problems with alignment? Did you just check it with &quot;sizeof&quot; beforehand?]]></description>
			<content:encoded><![CDATA[<p>Hi, thank you for the great example!<br />
One question. You use direct mapping of the structures into memory. How do you know that there will be no problems with alignment? Did you just check it with &#8220;sizeof&#8221; beforehand?</p>
]]></content:encoded>
		
			</item>
		<item>
		<title>
		By: Silver Moon		</title>
		<link>https://www.binarytides.com/raw-sockets-c-code-linux/comment-page-1/#comment-268087</link>

		<dc:creator><![CDATA[Silver Moon]]></dc:creator>
		<pubDate>Sun, 26 Jul 2020 14:36:33 +0000</pubDate>
		<guid isPermaLink="false">http://www.binarytides.com/blog/?p=60#comment-268087</guid>

					<description><![CDATA[In reply to &lt;a href=&quot;https://www.binarytides.com/raw-sockets-c-code-linux/comment-page-1/#comment-155595&quot;&gt;Dev&lt;/a&gt;.

if you need to receive the data then it is not recommended to use raw sockets. 
Just use normal tcp or udp sockets to send and receive data.]]></description>
			<content:encoded><![CDATA[<p>In reply to <a href="https://www.binarytides.com/raw-sockets-c-code-linux/comment-page-1/#comment-155595">Dev</a>.</p>
<p>if you need to receive the data then it is not recommended to use raw sockets.<br />
Just use normal tcp or udp sockets to send and receive data.</p>
]]></content:encoded>
		
			</item>
		<item>
		<title>
		By: Majid		</title>
		<link>https://www.binarytides.com/raw-sockets-c-code-linux/comment-page-1/#comment-157929</link>

		<dc:creator><![CDATA[Majid]]></dc:creator>
		<pubDate>Sat, 05 May 2018 10:24:41 +0000</pubDate>
		<guid isPermaLink="false">http://www.binarytides.com/blog/?p=60#comment-157929</guid>

					<description><![CDATA[also you can using below checksum function in your codes instead of this checksum function because this function may not work correctly on all processor architecture.
https://locklessinc.com/articles/tcp_checksum/

proposed checksum is second function in this link. you can read descriptions about different functions in above link.

Thanks.]]></description>
			<content:encoded><![CDATA[<p>also you can using below checksum function in your codes instead of this checksum function because this function may not work correctly on all processor architecture.<br />
<a href="https://locklessinc.com/articles/tcp_checksum/" rel="nofollow ugc">https://locklessinc.com/articles/tcp_checksum/</a></p>
<p>proposed checksum is second function in this link. you can read descriptions about different functions in above link.</p>
<p>Thanks.</p>
]]></content:encoded>
		
			</item>
		<item>
		<title>
		By: Majid		</title>
		<link>https://www.binarytides.com/raw-sockets-c-code-linux/comment-page-1/#comment-157928</link>

		<dc:creator><![CDATA[Majid]]></dc:creator>
		<pubDate>Sat, 05 May 2018 10:21:41 +0000</pubDate>
		<guid isPermaLink="false">http://www.binarytides.com/blog/?p=60#comment-157928</guid>

					<description><![CDATA[hi dears,
this code has one problem:
1. you must send size of IP header for checksum function instead of iph-&#062;tot_len because this field is sum of IP and TCP with data part. (IP header size is 20 byte)

Thanks.]]></description>
			<content:encoded><![CDATA[<p>hi dears,<br />
this code has one problem:<br />
1. you must send size of IP header for checksum function instead of iph-&gt;tot_len because this field is sum of IP and TCP with data part. (IP header size is 20 byte)</p>
<p>Thanks.</p>
]]></content:encoded>
		
			</item>
		<item>
		<title>
		By: Mike		</title>
		<link>https://www.binarytides.com/raw-sockets-c-code-linux/comment-page-1/#comment-157444</link>

		<dc:creator><![CDATA[Mike]]></dc:creator>
		<pubDate>Tue, 17 Apr 2018 15:57:50 +0000</pubDate>
		<guid isPermaLink="false">http://www.binarytides.com/blog/?p=60#comment-157444</guid>

					<description><![CDATA[Why is the payload in hexadecimal form?]]></description>
			<content:encoded><![CDATA[<p>Why is the payload in hexadecimal form?</p>
]]></content:encoded>
		
			</item>
		<item>
		<title>
		By: Dev		</title>
		<link>https://www.binarytides.com/raw-sockets-c-code-linux/comment-page-1/#comment-155595</link>

		<dc:creator><![CDATA[Dev]]></dc:creator>
		<pubDate>Sun, 18 Feb 2018 18:37:02 +0000</pubDate>
		<guid isPermaLink="false">http://www.binarytides.com/blog/?p=60#comment-155595</guid>

					<description><![CDATA[If i want receive the data then what should i have to do ?]]></description>
			<content:encoded><![CDATA[<p>If i want receive the data then what should i have to do ?</p>
]]></content:encoded>
		
			</item>
		<item>
		<title>
		By: SAURAV SEN		</title>
		<link>https://www.binarytides.com/raw-sockets-c-code-linux/comment-page-1/#comment-136417</link>

		<dc:creator><![CDATA[SAURAV SEN]]></dc:creator>
		<pubDate>Sat, 21 Oct 2017 11:26:52 +0000</pubDate>
		<guid isPermaLink="false">http://www.binarytides.com/blog/?p=60#comment-136417</guid>

					<description><![CDATA[sir why datagram is of size 4096...have u taken it randomly or thorugh some calculation??

struct iphdr *iph = (struct iphdr *) datagram;
     
    //TCP header
    struct tcphdr *tcph = (struct tcphdr *) (datagram + sizeof (struct ip));

please explain sir this it will be helpful if u mail me... also]]></description>
			<content:encoded><![CDATA[<p>sir why datagram is of size 4096&#8230;have u taken it randomly or thorugh some calculation??</p>
<p>struct iphdr *iph = (struct iphdr *) datagram;</p>
<p>    //TCP header<br />
    struct tcphdr *tcph = (struct tcphdr *) (datagram + sizeof (struct ip));</p>
<p>please explain sir this it will be helpful if u mail me&#8230; also</p>
]]></content:encoded>
		
			</item>
		<item>
		<title>
		By: Joseph		</title>
		<link>https://www.binarytides.com/raw-sockets-c-code-linux/comment-page-1/#comment-85149</link>

		<dc:creator><![CDATA[Joseph]]></dc:creator>
		<pubDate>Wed, 22 Jun 2016 14:08:21 +0000</pubDate>
		<guid isPermaLink="false">http://www.binarytides.com/blog/?p=60#comment-85149</guid>

					<description><![CDATA[Nice example:  I am a little confused about the IPH checksum. you are passing  iph-&#062;tot_len to csum(), which looks to include the data.  I thought the IPH checksum was confined to only the header. Tx.]]></description>
			<content:encoded><![CDATA[<p>Nice example:  I am a little confused about the IPH checksum. you are passing  iph-&gt;tot_len to csum(), which looks to include the data.  I thought the IPH checksum was confined to only the header. Tx.</p>
]]></content:encoded>
		
			</item>
		<item>
		<title>
		By: Sruthi		</title>
		<link>https://www.binarytides.com/raw-sockets-c-code-linux/comment-page-1/#comment-76841</link>

		<dc:creator><![CDATA[Sruthi]]></dc:creator>
		<pubDate>Tue, 10 May 2016 10:25:26 +0000</pubDate>
		<guid isPermaLink="false">http://www.binarytides.com/blog/?p=60#comment-76841</guid>

					<description><![CDATA[Can I get the code for SMTP raw socketing?]]></description>
			<content:encoded><![CDATA[<p>Can I get the code for SMTP raw socketing?</p>
]]></content:encoded>
		
			</item>
		<item>
		<title>
		By: Abhishek Sagar		</title>
		<link>https://www.binarytides.com/raw-sockets-c-code-linux/comment-page-1/#comment-75978</link>

		<dc:creator><![CDATA[Abhishek Sagar]]></dc:creator>
		<pubDate>Tue, 03 May 2016 11:31:03 +0000</pubDate>
		<guid isPermaLink="false">http://www.binarytides.com/blog/?p=60#comment-75978</guid>

					<description><![CDATA[In reply to &lt;a href=&quot;https://www.binarytides.com/raw-sockets-c-code-linux/comment-page-1/#comment-67774&quot;&gt;Nicolai Pascal Großer&lt;/a&gt;.

I began reading this article, because i wanted to learn how user can define his own L4 layer protocol, but you ended up preparing standard TCP packet. Anyways.... 
 Suppose if i define some XYZ layer 4 protocol, how the recieving machine would going to unwrap the layer 4 header as it may not aware of this non standard L4 header ??]]></description>
			<content:encoded><![CDATA[<p>In reply to <a href="https://www.binarytides.com/raw-sockets-c-code-linux/comment-page-1/#comment-67774">Nicolai Pascal Großer</a>.</p>
<p>I began reading this article, because i wanted to learn how user can define his own L4 layer protocol, but you ended up preparing standard TCP packet. Anyways&#8230;.<br />
 Suppose if i define some XYZ layer 4 protocol, how the recieving machine would going to unwrap the layer 4 header as it may not aware of this non standard L4 header ??</p>
]]></content:encoded>
		
			</item>
		<item>
		<title>
		By: Imed Ontario		</title>
		<link>https://www.binarytides.com/raw-sockets-c-code-linux/comment-page-1/#comment-68113</link>

		<dc:creator><![CDATA[Imed Ontario]]></dc:creator>
		<pubDate>Tue, 29 Dec 2015 04:09:00 +0000</pubDate>
		<guid isPermaLink="false">http://www.binarytides.com/blog/?p=60#comment-68113</guid>

					<description><![CDATA[thannnnks, can you give us the modified raw tcp code for the ipv6 please ?]]></description>
			<content:encoded><![CDATA[<p>thannnnks, can you give us the modified raw tcp code for the ipv6 please ?</p>
]]></content:encoded>
		
			</item>
		<item>
		<title>
		By: Alex		</title>
		<link>https://www.binarytides.com/raw-sockets-c-code-linux/comment-page-1/#comment-67992</link>

		<dc:creator><![CDATA[Alex]]></dc:creator>
		<pubDate>Sat, 11 Jul 2015 15:32:00 +0000</pubDate>
		<guid isPermaLink="false">http://www.binarytides.com/blog/?p=60#comment-67992</guid>

					<description><![CDATA[Hello,

Very good example and explanations. Since I make use of raw sockets to send crafted TCP packets in my program, I was looking for an example on the web for exact variables, structures etc. and after reading many of those, I can tell you sir, Your&#039;s explanation is excellent. Not only you&#039;re mentioning all the correct fields. you&#039;re also demonstrating using it with some excellent example.

However, since you&#039;re using &quot;malloc&quot; in your example, shouldn&#039;t you &quot;free&quot; it before the program ends?]]></description>
			<content:encoded><![CDATA[<p>Hello,</p>
<p>Very good example and explanations. Since I make use of raw sockets to send crafted TCP packets in my program, I was looking for an example on the web for exact variables, structures etc. and after reading many of those, I can tell you sir, Your&#8217;s explanation is excellent. Not only you&#8217;re mentioning all the correct fields. you&#8217;re also demonstrating using it with some excellent example.</p>
<p>However, since you&#8217;re using &#8220;malloc&#8221; in your example, shouldn&#8217;t you &#8220;free&#8221; it before the program ends?</p>
]]></content:encoded>
		
			</item>
		<item>
		<title>
		By: Nicolai Pascal Großer		</title>
		<link>https://www.binarytides.com/raw-sockets-c-code-linux/comment-page-1/#comment-67774</link>

		<dc:creator><![CDATA[Nicolai Pascal Großer]]></dc:creator>
		<pubDate>Mon, 02 Feb 2015 15:53:00 +0000</pubDate>
		<guid isPermaLink="false">http://www.binarytides.com/blog/?p=60#comment-67774</guid>

					<description><![CDATA[In reply to &lt;a href=&quot;https://www.binarytides.com/raw-sockets-c-code-linux/comment-page-1/#comment-67772&quot;&gt;Nicolai Pascal Großer&lt;/a&gt;.

Okay. I just checked out the header files. It is actually the same.
Probably some Linux/BSD stuff.]]></description>
			<content:encoded><![CDATA[<p>In reply to <a href="https://www.binarytides.com/raw-sockets-c-code-linux/comment-page-1/#comment-67772">Nicolai Pascal Großer</a>.</p>
<p>Okay. I just checked out the header files. It is actually the same.<br />
Probably some Linux/BSD stuff.</p>
]]></content:encoded>
		
			</item>
		<item>
		<title>
		By: Nicolai Pascal Großer		</title>
		<link>https://www.binarytides.com/raw-sockets-c-code-linux/comment-page-1/#comment-67772</link>

		<dc:creator><![CDATA[Nicolai Pascal Großer]]></dc:creator>
		<pubDate>Mon, 02 Feb 2015 01:48:00 +0000</pubDate>
		<guid isPermaLink="false">http://www.binarytides.com/blog/?p=60#comment-67772</guid>

					<description><![CDATA[where is the difference between &quot;struct iphdr&quot; and &quot;struct ip&quot;
Why do you use &quot;struct ip&quot; in line 74 ?]]></description>
			<content:encoded><![CDATA[<p>where is the difference between &#8220;struct iphdr&#8221; and &#8220;struct ip&#8221;<br />
Why do you use &#8220;struct ip&#8221; in line 74 ?</p>
]]></content:encoded>
		
			</item>
		<item>
		<title>
		By: Ivan		</title>
		<link>https://www.binarytides.com/raw-sockets-c-code-linux/comment-page-1/#comment-65988</link>

		<dc:creator><![CDATA[Ivan]]></dc:creator>
		<pubDate>Wed, 19 Feb 2014 11:59:00 +0000</pubDate>
		<guid isPermaLink="false">http://www.binarytides.com/blog/?p=60#comment-65988</guid>

					<description><![CDATA[Thanks for the example. How do I send a complete http get request to a particular uri?]]></description>
			<content:encoded><![CDATA[<p>Thanks for the example. How do I send a complete http get request to a particular uri?</p>
]]></content:encoded>
		
			</item>
		<item>
		<title>
		By: Vijay Kanta		</title>
		<link>https://www.binarytides.com/raw-sockets-c-code-linux/comment-page-1/#comment-65596</link>

		<dc:creator><![CDATA[Vijay Kanta]]></dc:creator>
		<pubDate>Fri, 28 Jun 2013 13:17:00 +0000</pubDate>
		<guid isPermaLink="false">http://www.binarytides.com/blog/?p=60#comment-65596</guid>

					<description><![CDATA[Wow, I knew a bit of socket programming with pure C, but this is taking it too deeper. Thanks for letting me know it even existed. :-)]]></description>
			<content:encoded><![CDATA[<p>Wow, I knew a bit of socket programming with pure C, but this is taking it too deeper. Thanks for letting me know it even existed. :-)</p>
]]></content:encoded>
		
			</item>
		<item>
		<title>
		By: Silver Moon		</title>
		<link>https://www.binarytides.com/raw-sockets-c-code-linux/comment-page-1/#comment-65591</link>

		<dc:creator><![CDATA[Silver Moon]]></dc:creator>
		<pubDate>Thu, 27 Jun 2013 12:37:00 +0000</pubDate>
		<guid isPermaLink="false">http://www.binarytides.com/blog/?p=60#comment-65591</guid>

					<description><![CDATA[In reply to &lt;a href=&quot;https://www.binarytides.com/raw-sockets-c-code-linux/comment-page-1/#comment-65590&quot;&gt;John Lauro&lt;/a&gt;.

yeah right, thanks for pointing it out. shall fix the code to be more portable and post soon.]]></description>
			<content:encoded><![CDATA[<p>In reply to <a href="https://www.binarytides.com/raw-sockets-c-code-linux/comment-page-1/#comment-65590">John Lauro</a>.</p>
<p>yeah right, thanks for pointing it out. shall fix the code to be more portable and post soon.</p>
]]></content:encoded>
		
			</item>
		<item>
		<title>
		By: John Lauro		</title>
		<link>https://www.binarytides.com/raw-sockets-c-code-linux/comment-page-1/#comment-65590</link>

		<dc:creator><![CDATA[John Lauro]]></dc:creator>
		<pubDate>Thu, 27 Jun 2013 12:33:00 +0000</pubDate>
		<guid isPermaLink="false">http://www.binarytides.com/blog/?p=60#comment-65590</guid>

					<description><![CDATA[The code makes some architecture assumptions that will probably work 99% of the time, but isn&#039;t completely portable.  For example, the checksum calculation assumes short is 2 bytes, and will likely segfault on anything where it is larger.]]></description>
			<content:encoded><![CDATA[<p>The code makes some architecture assumptions that will probably work 99% of the time, but isn&#8217;t completely portable.  For example, the checksum calculation assumes short is 2 bytes, and will likely segfault on anything where it is larger.</p>
]]></content:encoded>
		
			</item>
		<item>
		<title>
		By: Silver Moon		</title>
		<link>https://www.binarytides.com/raw-sockets-c-code-linux/comment-page-1/#comment-65589</link>

		<dc:creator><![CDATA[Silver Moon]]></dc:creator>
		<pubDate>Thu, 27 Jun 2013 03:30:00 +0000</pubDate>
		<guid isPermaLink="false">http://www.binarytides.com/blog/?p=60#comment-65589</guid>

					<description><![CDATA[In reply to &lt;a href=&quot;https://www.binarytides.com/raw-sockets-c-code-linux/comment-page-1/#comment-65586&quot;&gt;patrick h&lt;/a&gt;.

thanks for pointing it out. the total_length value should be passed through htons.
the code works well because the kernel fills in the correct total length in the ip header.]]></description>
			<content:encoded><![CDATA[<p>In reply to <a href="https://www.binarytides.com/raw-sockets-c-code-linux/comment-page-1/#comment-65586">patrick h</a>.</p>
<p>thanks for pointing it out. the total_length value should be passed through htons.<br />
the code works well because the kernel fills in the correct total length in the ip header.</p>
]]></content:encoded>
		
			</item>
		<item>
		<title>
		By: patrick h		</title>
		<link>https://www.binarytides.com/raw-sockets-c-code-linux/comment-page-1/#comment-65586</link>

		<dc:creator><![CDATA[patrick h]]></dc:creator>
		<pubDate>Thu, 27 Jun 2013 03:08:00 +0000</pubDate>
		<guid isPermaLink="false">http://www.binarytides.com/blog/?p=60#comment-65586</guid>

					<description><![CDATA[Shouldn&#039;t iph-&#062;tot_len be hton&#039;d?


Seems like there are several fields in the headers that need to be hton&#039;d and they dont seem to be present in this example...


does this example work?  or am i missing something?]]></description>
			<content:encoded><![CDATA[<p>Shouldn&#8217;t iph-&gt;tot_len be hton&#8217;d?</p>
<p>Seems like there are several fields in the headers that need to be hton&#8217;d and they dont seem to be present in this example&#8230;</p>
<p>does this example work?  or am i missing something?</p>
]]></content:encoded>
		
			</item>
	</channel>
</rss>
