<?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: Programming UDP sockets in C on Linux &#8211; Client and Server example	</title>
	<atom:link href="https://www.binarytides.com/programming-udp-sockets-c-linux/feed/" rel="self" type="application/rss+xml" />
	<link>https://www.binarytides.com/programming-udp-sockets-c-linux/</link>
	<description>News, Technology, Entertainment and more</description>
	<lastBuildDate>Mon, 07 Jun 2021 09:40:54 +0000</lastBuildDate>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	<generator>https://wordpress.org/?v=6.8.2</generator>
	<item>
		<title>
		By: Joe		</title>
		<link>https://www.binarytides.com/programming-udp-sockets-c-linux/comment-page-1/#comment-319105</link>

		<dc:creator><![CDATA[Joe]]></dc:creator>
		<pubDate>Mon, 07 Jun 2021 09:40:54 +0000</pubDate>
		<guid isPermaLink="false">http://www.binarytides.com/?p=2736#comment-319105</guid>

					<description><![CDATA[Hello. You seem to have double pasted the second code sample inside itself. THanks for the tutorial]]></description>
			<content:encoded><![CDATA[<p>Hello. You seem to have double pasted the second code sample inside itself. THanks for the tutorial</p>
]]></content:encoded>
		
			</item>
		<item>
		<title>
		By: Big man		</title>
		<link>https://www.binarytides.com/programming-udp-sockets-c-linux/comment-page-1/#comment-165914</link>

		<dc:creator><![CDATA[Big man]]></dc:creator>
		<pubDate>Thu, 16 Aug 2018 14:28:02 +0000</pubDate>
		<guid isPermaLink="false">http://www.binarytides.com/?p=2736#comment-165914</guid>

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

Silver Moon’s approach will work but the best way would be to listen for socket connections asynchronously using epoll() and using TCP not UDP,  UDP is unreliable so some of your commands might not make it to the server as intended. That’s what is done in most modern socket servers. Try googling how to use epoll() (Linux system call so should work on Raspberry Pi). It will allow you to have an efficient and scalable socket server. (I am actually almost done developing an IoT socket communication system myself using raspberry pi as main server and epoll() with TCP is the best approach for this kind of stuff as far as I know.]]></description>
			<content:encoded><![CDATA[<p>In reply to <a href="https://www.binarytides.com/programming-udp-sockets-c-linux/comment-page-1/#comment-165842">Nathan</a>.</p>
<p>Silver Moon’s approach will work but the best way would be to listen for socket connections asynchronously using epoll() and using TCP not UDP,  UDP is unreliable so some of your commands might not make it to the server as intended. That’s what is done in most modern socket servers. Try googling how to use epoll() (Linux system call so should work on Raspberry Pi). It will allow you to have an efficient and scalable socket server. (I am actually almost done developing an IoT socket communication system myself using raspberry pi as main server and epoll() with TCP is the best approach for this kind of stuff as far as I know.</p>
]]></content:encoded>
		
			</item>
		<item>
		<title>
		By: Silver Moon		</title>
		<link>https://www.binarytides.com/programming-udp-sockets-c-linux/comment-page-1/#comment-165843</link>

		<dc:creator><![CDATA[Silver Moon]]></dc:creator>
		<pubDate>Tue, 14 Aug 2018 11:23:44 +0000</pubDate>
		<guid isPermaLink="false">http://www.binarytides.com/?p=2736#comment-165843</guid>

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

i haven&#039;t done sockets for a long time. right now i can think of using multiple threads do things in parallel. 
so the main thread could do its background work, and an extra thread could listen to the udp port for incoming messages.
or the other way round.
but i am not sure if that is the best approach. there might be better alternatives.]]></description>
			<content:encoded><![CDATA[<p>In reply to <a href="https://www.binarytides.com/programming-udp-sockets-c-linux/comment-page-1/#comment-165842">Nathan</a>.</p>
<p>i haven&#8217;t done sockets for a long time. right now i can think of using multiple threads do things in parallel.<br />
so the main thread could do its background work, and an extra thread could listen to the udp port for incoming messages.<br />
or the other way round.<br />
but i am not sure if that is the best approach. there might be better alternatives.</p>
]]></content:encoded>
		
			</item>
		<item>
		<title>
		By: Nathan		</title>
		<link>https://www.binarytides.com/programming-udp-sockets-c-linux/comment-page-1/#comment-165842</link>

		<dc:creator><![CDATA[Nathan]]></dc:creator>
		<pubDate>Tue, 14 Aug 2018 10:32:16 +0000</pubDate>
		<guid isPermaLink="false">http://www.binarytides.com/?p=2736#comment-165842</guid>

					<description><![CDATA[Hey Silver Moon,

I&#039;m a not a programmer but are very interested in electronics and making things automated. This was very helpful example of udp socket communications. What I did find though was the program doesn&#039;t do anything else whilst it waits for data. How would you suggest to say send this server &quot;Blink Led 1&quot; and continue to listen for commands to turn on, blink or turn off leds.
I can for example blink the led no problem in one project, I can get you code also running on a pi and responding to commands I send it now but I would like to be able to continue doing things in the background.

Thanks for you time.]]></description>
			<content:encoded><![CDATA[<p>Hey Silver Moon,</p>
<p>I&#8217;m a not a programmer but are very interested in electronics and making things automated. This was very helpful example of udp socket communications. What I did find though was the program doesn&#8217;t do anything else whilst it waits for data. How would you suggest to say send this server &#8220;Blink Led 1&#8221; and continue to listen for commands to turn on, blink or turn off leds.<br />
I can for example blink the led no problem in one project, I can get you code also running on a pi and responding to commands I send it now but I would like to be able to continue doing things in the background.</p>
<p>Thanks for you time.</p>
]]></content:encoded>
		
			</item>
		<item>
		<title>
		By: Nataliya K		</title>
		<link>https://www.binarytides.com/programming-udp-sockets-c-linux/comment-page-1/#comment-165566</link>

		<dc:creator><![CDATA[Nataliya K]]></dc:creator>
		<pubDate>Tue, 07 Aug 2018 09:19:25 +0000</pubDate>
		<guid isPermaLink="false">http://www.binarytides.com/?p=2736#comment-165566</guid>

					<description><![CDATA[Thx! This article was really helpful for understanding some basic things about socket programming.]]></description>
			<content:encoded><![CDATA[<p>Thx! This article was really helpful for understanding some basic things about socket programming.</p>
]]></content:encoded>
		
			</item>
		<item>
		<title>
		By: Mattia FFF		</title>
		<link>https://www.binarytides.com/programming-udp-sockets-c-linux/comment-page-1/#comment-157952</link>

		<dc:creator><![CDATA[Mattia FFF]]></dc:creator>
		<pubDate>Sun, 06 May 2018 14:36:36 +0000</pubDate>
		<guid isPermaLink="false">http://www.binarytides.com/?p=2736#comment-157952</guid>

					<description><![CDATA[Thank you so much for this, it was really helpful!]]></description>
			<content:encoded><![CDATA[<p>Thank you so much for this, it was really helpful!</p>
]]></content:encoded>
		
			</item>
		<item>
		<title>
		By: Bryan Kelly		</title>
		<link>https://www.binarytides.com/programming-udp-sockets-c-linux/comment-page-1/#comment-156275</link>

		<dc:creator><![CDATA[Bryan Kelly]]></dc:creator>
		<pubDate>Wed, 14 Mar 2018 22:42:36 +0000</pubDate>
		<guid isPermaLink="false">http://www.binarytides.com/?p=2736#comment-156275</guid>

					<description><![CDATA[In reply to &lt;a href=&quot;https://www.binarytides.com/programming-udp-sockets-c-linux/comment-page-1/#comment-156224&quot;&gt;Bryan Kelly&lt;/a&gt;.

And ncat used option -vv which on my Ubuntu system means verbose.  The captured text does not have the verbose output.  My system had five lines of information for each line of typed in data.
Still, I am new to Linux and Ubuntu and this is an unexpected cool way to test the server app.
Thank you.]]></description>
			<content:encoded><![CDATA[<p>In reply to <a href="https://www.binarytides.com/programming-udp-sockets-c-linux/comment-page-1/#comment-156224">Bryan Kelly</a>.</p>
<p>And ncat used option -vv which on my Ubuntu system means verbose.  The captured text does not have the verbose output.  My system had five lines of information for each line of typed in data.<br />
Still, I am new to Linux and Ubuntu and this is an unexpected cool way to test the server app.<br />
Thank you.</p>
]]></content:encoded>
		
			</item>
		<item>
		<title>
		By: Bryan Kelly		</title>
		<link>https://www.binarytides.com/programming-udp-sockets-c-linux/comment-page-1/#comment-156224</link>

		<dc:creator><![CDATA[Bryan Kelly]]></dc:creator>
		<pubDate>Mon, 12 Mar 2018 23:06:07 +0000</pubDate>
		<guid isPermaLink="false">http://www.binarytides.com/?p=2736#comment-156224</guid>

					<description><![CDATA[update note:  Ubuntu 16.04.3. gcc 5.4.0 complained until slen was declared unsigned int.]]></description>
			<content:encoded><![CDATA[<p>update note:  Ubuntu 16.04.3. gcc 5.4.0 complained until slen was declared unsigned int.</p>
]]></content:encoded>
		
			</item>
		<item>
		<title>
		By: updogliu		</title>
		<link>https://www.binarytides.com/programming-udp-sockets-c-linux/comment-page-1/#comment-155982</link>

		<dc:creator><![CDATA[updogliu]]></dc:creator>
		<pubDate>Sat, 03 Mar 2018 00:44:13 +0000</pubDate>
		<guid isPermaLink="false">http://www.binarytides.com/?p=2736#comment-155982</guid>

					<description><![CDATA[Very helpful. Thanks!]]></description>
			<content:encoded><![CDATA[<p>Very helpful. Thanks!</p>
]]></content:encoded>
		
			</item>
		<item>
		<title>
		By: jenny		</title>
		<link>https://www.binarytides.com/programming-udp-sockets-c-linux/comment-page-1/#comment-119842</link>

		<dc:creator><![CDATA[jenny]]></dc:creator>
		<pubDate>Mon, 29 May 2017 09:08:01 +0000</pubDate>
		<guid isPermaLink="false">http://www.binarytides.com/?p=2736#comment-119842</guid>

					<description><![CDATA[Hi, I am new to socket programminga and linux , can you tell me ... can we turn a system into a server ? and do communication using above programming? can we establish communication on the microcontroller using above programs?]]></description>
			<content:encoded><![CDATA[<p>Hi, I am new to socket programminga and linux , can you tell me &#8230; can we turn a system into a server ? and do communication using above programming? can we establish communication on the microcontroller using above programs?</p>
]]></content:encoded>
		
			</item>
		<item>
		<title>
		By: Mefew		</title>
		<link>https://www.binarytides.com/programming-udp-sockets-c-linux/comment-page-1/#comment-98477</link>

		<dc:creator><![CDATA[Mefew]]></dc:creator>
		<pubDate>Tue, 15 Nov 2016 22:19:02 +0000</pubDate>
		<guid isPermaLink="false">http://www.binarytides.com/?p=2736#comment-98477</guid>

					<description><![CDATA[Excelent example, thanks very much!
I&#039;ve found that it needs only a tiny addition.
To clean the buffer on the server also. So just adding on Server:

//keep listening for data
    while(1)
    {
        printf(&quot;Waiting for data...&quot;);
        fflush(stdout);
        memset(buf,&#039;\0&#039;, BUFLEN);        //Add this line]]></description>
			<content:encoded><![CDATA[<p>Excelent example, thanks very much!<br />
I&#8217;ve found that it needs only a tiny addition.<br />
To clean the buffer on the server also. So just adding on Server:</p>
<p>//keep listening for data<br />
    while(1)<br />
    {<br />
        printf(&#8220;Waiting for data&#8230;&#8221;);<br />
        fflush(stdout);<br />
        memset(buf,&#8217;\0&#8242;, BUFLEN);        //Add this line</p>
]]></content:encoded>
		
			</item>
		<item>
		<title>
		By: dot		</title>
		<link>https://www.binarytides.com/programming-udp-sockets-c-linux/comment-page-1/#comment-70437</link>

		<dc:creator><![CDATA[dot]]></dc:creator>
		<pubDate>Mon, 14 Mar 2016 18:35:37 +0000</pubDate>
		<guid isPermaLink="false">http://www.binarytides.com/?p=2736#comment-70437</guid>

					<description><![CDATA[if that sent character, how about send some file, example a picture, how to change in the script character sent to picture sent..?]]></description>
			<content:encoded><![CDATA[<p>if that sent character, how about send some file, example a picture, how to change in the script character sent to picture sent..?</p>
]]></content:encoded>
		
			</item>
		<item>
		<title>
		By: Sergeylo		</title>
		<link>https://www.binarytides.com/programming-udp-sockets-c-linux/comment-page-1/#comment-68324</link>

		<dc:creator><![CDATA[Sergeylo]]></dc:creator>
		<pubDate>Thu, 18 Feb 2016 16:55:56 +0000</pubDate>
		<guid isPermaLink="false">http://www.binarytides.com/?p=2736#comment-68324</guid>

					<description><![CDATA[Please remove gets in Client:46 with:
fgets(message, BUFLEN, stdin);]]></description>
			<content:encoded><![CDATA[<p>Please remove gets in Client:46 with:<br />
fgets(message, BUFLEN, stdin);</p>
]]></content:encoded>
		
			</item>
		<item>
		<title>
		By: nishant		</title>
		<link>https://www.binarytides.com/programming-udp-sockets-c-linux/comment-page-1/#comment-67907</link>

		<dc:creator><![CDATA[nishant]]></dc:creator>
		<pubDate>Wed, 08 Apr 2015 13:53:00 +0000</pubDate>
		<guid isPermaLink="false">http://www.binarytides.com/?p=2736#comment-67907</guid>

					<description><![CDATA[What if the data sent from client side having some different Server address, SERVER 192.168.16.30 (this IP is pingable)]]></description>
			<content:encoded><![CDATA[<p>What if the data sent from client side having some different Server address, SERVER 192.168.16.30 (this IP is pingable)</p>
]]></content:encoded>
		
			</item>
		<item>
		<title>
		By: neal		</title>
		<link>https://www.binarytides.com/programming-udp-sockets-c-linux/comment-page-1/#comment-67545</link>

		<dc:creator><![CDATA[neal]]></dc:creator>
		<pubDate>Sat, 01 Nov 2014 19:08:00 +0000</pubDate>
		<guid isPermaLink="false">http://www.binarytides.com/?p=2736#comment-67545</guid>

					<description><![CDATA[how to pass array , vector etc. between client and server?]]></description>
			<content:encoded><![CDATA[<p>how to pass array , vector etc. between client and server?</p>
]]></content:encoded>
		
			</item>
		<item>
		<title>
		By: neal		</title>
		<link>https://www.binarytides.com/programming-udp-sockets-c-linux/comment-page-1/#comment-67544</link>

		<dc:creator><![CDATA[neal]]></dc:creator>
		<pubDate>Sat, 01 Nov 2014 16:57:00 +0000</pubDate>
		<guid isPermaLink="false">http://www.binarytides.com/?p=2736#comment-67544</guid>

					<description><![CDATA[if ((recv_len = recvfrom(s, buf, BUFLEN, 0, (struct sockaddr *) &#038;si_other, &#038;slen)) == -1)

here   &#038;slen should be (socklen_t*)&#038;slen . and work perfectly. Thank u]]></description>
			<content:encoded><![CDATA[<p>if ((recv_len = recvfrom(s, buf, BUFLEN, 0, (struct sockaddr *) &amp;si_other, &amp;slen)) == -1)</p>
<p>here   &amp;slen should be (socklen_t*)&amp;slen . and work perfectly. Thank u</p>
]]></content:encoded>
		
			</item>
	</channel>
</rss>
