<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"><channel><title><![CDATA[Wie prüfen ob socket schon existiert?]]></title><description><![CDATA[<p>Hallo,</p>
<p>ich kenne mich mit Sockets wenig bis gar nicht aus. Ich öffne einen socket so:</p>
<pre><code>void foo() {
    mySocket = socket(AF_INET, SOCK_DGRAM, IPPROTO_UDP);
}
</code></pre>
<p>Wie kann ich prüfen (z.B. wenn ich von irgendwo anders) ein 2tes mal foo aufrufe<br />
ob mySocket schon existiert? Ich würde gerne eine Abfrage einbauen wie z.B.</p>
<pre><code>void foo() {
    if(mySocket != NULL) 
        mySocket = socket(AF_INET, SOCK_DGRAM, IPPROTO_UDP);
}
</code></pre>
<p>Danke für Hilfe</p>
]]></description><link>https://www.c-plusplus.net/forum/topic/339721/wie-prüfen-ob-socket-schon-existiert</link><generator>RSS for Node</generator><lastBuildDate>Sat, 11 Apr 2026 21:39:30 GMT</lastBuildDate><atom:link href="https://www.c-plusplus.net/forum/topic/339721.rss" rel="self" type="application/rss+xml"/><pubDate>Fri, 23 Sep 2016 11:49:25 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to Wie prüfen ob socket schon existiert? on Fri, 23 Sep 2016 11:49:25 GMT]]></title><description><![CDATA[<p>Hallo,</p>
<p>ich kenne mich mit Sockets wenig bis gar nicht aus. Ich öffne einen socket so:</p>
<pre><code>void foo() {
    mySocket = socket(AF_INET, SOCK_DGRAM, IPPROTO_UDP);
}
</code></pre>
<p>Wie kann ich prüfen (z.B. wenn ich von irgendwo anders) ein 2tes mal foo aufrufe<br />
ob mySocket schon existiert? Ich würde gerne eine Abfrage einbauen wie z.B.</p>
<pre><code>void foo() {
    if(mySocket != NULL) 
        mySocket = socket(AF_INET, SOCK_DGRAM, IPPROTO_UDP);
}
</code></pre>
<p>Danke für Hilfe</p>
]]></description><link>https://www.c-plusplus.net/forum/post/2509403</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2509403</guid><dc:creator><![CDATA[zumbo]]></dc:creator><pubDate>Fri, 23 Sep 2016 11:49:25 GMT</pubDate></item><item><title><![CDATA[Reply to Wie prüfen ob socket schon existiert? on Fri, 23 Sep 2016 12:12:50 GMT]]></title><description><![CDATA[<p>Setze den descriptor/handle Anfangs und bei closesocket auf INVALID_SOCKET.<br />
Dann einfach danach prüfen.</p>
<p>Siehe auch <a href="https://msdn.microsoft.com/en-us/library/windows/desktop/ms740506" rel="nofollow">https://msdn.microsoft.com/en-us/library/windows/desktop/ms740506</a></p>
]]></description><link>https://www.c-plusplus.net/forum/post/2509405</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2509405</guid><dc:creator><![CDATA[hihaho]]></dc:creator><pubDate>Fri, 23 Sep 2016 12:12:50 GMT</pubDate></item></channel></rss>