<?xml version="1.0" encoding="UTF-8"?>        <rss version="2.0"
             xmlns:atom="http://www.w3.org/2005/Atom"
             xmlns:dc="http://purl.org/dc/elements/1.1/"
             xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
             xmlns:admin="http://webns.net/mvcb/"
             xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
             xmlns:content="http://purl.org/rss/1.0/modules/content/">
        <channel>
            <title>
									Lazarus - MacOS X/Linux - Do a network Ping from within your appliccations - Delphi, Lazarus, Free Pascal				            </title>
            <link>https://www.tweaking4all.com/forum/delphi-lazarus-free-pascal/lazarus-macos-xlinux-do-a-network-ping-from-within-your-appliccations/</link>
            <description>Tweaking4All.com Discussion Board</description>
            <language>en-US</language>
            <lastBuildDate>Wed, 17 Jun 2026 04:31:21 +0000</lastBuildDate>
            <generator>wpForo</generator>
            <ttl>60</ttl>
							                    <item>
                        <title>RE: Lazarus - MacOS X/Linux - Do a network Ping from within your appliccations</title>
                        <link>https://www.tweaking4all.com/forum/delphi-lazarus-free-pascal/lazarus-macos-xlinux-do-a-network-ping-from-within-your-appliccations/#post-5522</link>
                        <pubDate>Sun, 23 Jun 2024 12:59:10 +0000</pubDate>
                        <description><![CDATA[For those writing apps with the intend to place them in the Apple App Store:
Applications in the App Store are sandboxed, which means that without the proper entitlements, PING will not wor...]]></description>
                        <content:encoded><![CDATA[<p>For those writing apps with the intend to place them in the <span style="color: #ff0000"><strong>Apple App Store</strong></span>:</p>
<p>Applications in the App Store are sandboxed, which means that without the proper entitlements, PING will not work.</p>
<p>After wasting an entire day on how to better implement ping (in code for example - note: Synapse's ping host function does not work under macOS), I found that you will need to set these 2 <span style="color: #ff0000">entitlements</span> for ping to work (in the code I presented above):</p>
<p><span style="color: #ff0000"><strong>com.apple.security.network.client</strong></span><br /><span style="color: #ff0000"><strong>com.apple.security.network.server</strong></span></p>
<p>One to send "signals" to the network, but the other one is also needed to receive the ping response. </p>
<p>So you entitlements.plist file could look something like this:</p>
<pre contenteditable="false">&lt;!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"&gt;
&lt;plist version="1.0"&gt;
&lt;dict&gt;
  &lt;key&gt;com.apple.security.app-sandbox&lt;/key&gt;
  &lt;true/&gt;
  &lt;key&gt;com.apple.security.network.server&lt;/key&gt;
  &lt;true/&gt;
  &lt;key&gt;com.apple.security.network.client&lt;/key&gt;
  &lt;true/&gt;
&lt;/dict&gt;
&lt;/plist&gt;</pre>
<p> </p>
<p>Hope that by posting this here I'm saving someone wasting a day as well &#x1f609; </p>]]></content:encoded>
						                            <category domain="https://www.tweaking4all.com/forum/delphi-lazarus-free-pascal/">Delphi, Lazarus, Free Pascal</category>                        <dc:creator>Hans</dc:creator>
                        <guid isPermaLink="true">https://www.tweaking4all.com/forum/delphi-lazarus-free-pascal/lazarus-macos-xlinux-do-a-network-ping-from-within-your-appliccations/#post-5522</guid>
                    </item>
				                    <item>
                        <title>RE: Lazarus - MacOS X/Linux - Do a network Ping from within your appliccations</title>
                        <link>https://www.tweaking4all.com/forum/delphi-lazarus-free-pascal/lazarus-macos-xlinux-do-a-network-ping-from-within-your-appliccations/#post-928</link>
                        <pubDate>Mon, 02 May 2016 11:21:59 +0000</pubDate>
                        <description><![CDATA[A version that works for Windows (tested Windows 10) and MacOS X (tested with El Capitan) - downside for Windows is the briefly popping up of a shell window.function Ping(Host:string):boolea...]]></description>
                        <content:encoded><![CDATA[<p>A version that works for Windows (tested Windows 10) and MacOS X (tested with El Capitan) - downside for Windows is the briefly popping up of a shell window.</p><pre>function Ping(Host:string):boolean;<br>var s : ansistring;<br>const PingCount   = '2'; // number of pings<br>&nbsp; &nbsp; &nbsp; PingTimeout = '2'; // timout for each ping<br>begin<br>&nbsp; s:='';<br>&nbsp; {$IFDEF Darwin}<br>&nbsp; RunCommand('/sbin/ping',,s);<br>&nbsp; {$ENDIF}<br>&nbsp; {$IFDEF Windows}<br>&nbsp; RunCommand('ping.exe',,s);<br>&nbsp; {$ENDIF}<br>&nbsp; Result := (pos('100.0% packet loss',S)=0) and (pos('100% packet loss',S)=0) and (pos('100% loss',S)=0);<br>end;</pre>]]></content:encoded>
						                            <category domain="https://www.tweaking4all.com/forum/delphi-lazarus-free-pascal/">Delphi, Lazarus, Free Pascal</category>                        <dc:creator>Hans</dc:creator>
                        <guid isPermaLink="true">https://www.tweaking4all.com/forum/delphi-lazarus-free-pascal/lazarus-macos-xlinux-do-a-network-ping-from-within-your-appliccations/#post-928</guid>
                    </item>
				                    <item>
                        <title>Lazarus - MacOS X/Linux - Do a network Ping from within your appliccations</title>
                        <link>https://www.tweaking4all.com/forum/delphi-lazarus-free-pascal/lazarus-macos-xlinux-do-a-network-ping-from-within-your-appliccations/#post-365</link>
                        <pubDate>Mon, 25 Apr 2016 15:31:31 +0000</pubDate>
                        <description><![CDATA[You could use Synapse to do a Ping, but so far I have had zero luck in executing any of the example codes - this appear related to required elevated admin rights to actually do a ping that w...]]></description>
                        <content:encoded><![CDATA[You could use Synapse to do a Ping, but so far I have had zero luck in executing any of the example codes - this appear related to required elevated admin rights to actually do a ping that way.
However ... you can do it by using the Terminal/Commandline "ping".&nbsp;<div><br></div><div>You will need to include the "<b>process</b>" unit in the <b>Uses</b> Clause.&nbsp;<div><br></div><div>Quickly wrapped in a simple function for <b>MacOS X </b>and<b> Linux</b> - This function <u><b>WILL NOT WORK </b>under<b> Windows</b></u>:</div><div><br>&nbsp;
<pre>function TForm1.Ping(Host:string):boolean;<br>var s : ansistring;<br>const PingCount   = '1'; // number of pings<br>&nbsp; &nbsp; &nbsp; PingTimeout = '2'; // timout for each ping<br>begin<br>&nbsp; {$IFDEF Darwin}<br>&nbsp; &nbsp; RunCommand('/sbin/ping',,s);<br>&nbsp; {$ELSE}<br>&nbsp; &nbsp; RunCommand('/bin/ping',,s);<br>&nbsp; {$ENDIF}<br>&nbsp; Result := (pos('100.0% packet loss',S)=0) and (pos('100% packet loss',S)=0);<br>end;&nbsp;</pre><div><br></div>I've tested this under MacOSX and Linux (Ubuntu / Freya OS).</div><div><br>You will see that time out parameter under MacOS X (-t) is slightly different than under Linux (-w), and that the location of ping is different as well.&nbsp;</div><div>The parameters and location might be different under different Linux versions as well.</div></div>]]></content:encoded>
						                            <category domain="https://www.tweaking4all.com/forum/delphi-lazarus-free-pascal/">Delphi, Lazarus, Free Pascal</category>                        <dc:creator>Hans</dc:creator>
                        <guid isPermaLink="true">https://www.tweaking4all.com/forum/delphi-lazarus-free-pascal/lazarus-macos-xlinux-do-a-network-ping-from-within-your-appliccations/#post-365</guid>
                    </item>
							        </channel>
        </rss>
		