<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/">
<channel>
<title>Non-Blocking Sockets?</title>
<description> Hello all,

I&amp;#039;m having issues setting my TCP and UDP sockets to non-blocking. Is this an issue in the current libraries, is there a work around or am I doing something wrong. Here&amp;#039;s my code for the connection socket. I browsed around the forum and found another post from months ago that said non-blocking sockets did not work, but nobody commented.


int client_connect(char* ip,int protocol)
{
c_protocol = protocol;

net_init();

client_connected = false;
connection_socket = net_socket(AF_INET, protocol == TCP ? SOCK_STREAM : SOCK_DGRAM,IPPROTO_IP);
if (connection_socket == 0) return 0;

memset(&amp;client,0, sizeof(client));

client.sin_addr.s_addr = inet_addr(ip);

client.sin_family = AF_INET;
client.sin_port = htons(CON_PORT);

if(protocol == TCP)
if (net_connect(connection_socket,(struct sockaddr*)&amp;client,sizeof(client)) != 0) return 0;


unsigned long flag = O_NONBLOCK;
net_ioctl(connection_socket, FIONBIO, &amp;flag);

client_connected = true;
mode = CLIENT;

return 1;
}
</description><link>http://forum.wiibrew.org/read.php?11,8253,8253#msg-8253</link><lastBuildDate>Thu, 08 Oct 2026 06:16:24 +0200</lastBuildDate>
<generator>Phorum 5.2.23</generator>
<item>
<guid>http://forum.wiibrew.org/read.php?11,8253,8288#msg-8288</guid>
<title>Re: Non-Blocking Sockets?</title><link>http://forum.wiibrew.org/read.php?11,8253,8288#msg-8288</link><description><![CDATA[ I was told in another thread that ftpii uses nonblocking sockets, so that might be a source of more help if you still need it.]]></description>
<dc:creator>iofthestorm</dc:creator>
<category>Coding</category><pubDate>Mon, 19 Jan 2009 04:33:21 +0100</pubDate></item>
<item>
<guid>http://forum.wiibrew.org/read.php?11,8253,8262#msg-8262</guid>
<title>Re: Non-Blocking Sockets?</title><link>http://forum.wiibrew.org/read.php?11,8253,8262#msg-8262</link><description><![CDATA[ my pleasure. i tried tons of things to get this working too :)<br />i guess nobody cares, but i&#039;ll mention it anyway:<br />i wanted non-blocking sockets for hbc, but bushing epicfailed on reversing the required magic bit for me, so i bruteforced it until EAGAIN finally popped up ;)]]></description>
<dc:creator>dhewg</dc:creator>
<category>Coding</category><pubDate>Mon, 19 Jan 2009 01:36:19 +0100</pubDate></item>
<item>
<guid>http://forum.wiibrew.org/read.php?11,8253,8261#msg-8261</guid>
<title>Re: Non-Blocking Sockets?</title><link>http://forum.wiibrew.org/read.php?11,8253,8261#msg-8261</link><description><![CDATA[ Also thanks from here :)]]></description>
<dc:creator>zman</dc:creator>
<category>Coding</category><pubDate>Mon, 19 Jan 2009 01:28:37 +0100</pubDate></item>
<item>
<guid>http://forum.wiibrew.org/read.php?11,8253,8257#msg-8257</guid>
<title>Re: Non-Blocking Sockets?</title><link>http://forum.wiibrew.org/read.php?11,8253,8257#msg-8257</link><description><![CDATA[ Thank you very much :)]]></description>
<dc:creator>scanff</dc:creator>
<category>Coding</category><pubDate>Mon, 19 Jan 2009 00:53:12 +0100</pubDate></item>
<item>
<guid>http://forum.wiibrew.org/read.php?11,8253,8255#msg-8255</guid>
<title>Re: Non-Blocking Sockets?</title><link>http://forum.wiibrew.org/read.php?11,8253,8255#msg-8255</link><description><![CDATA[ <pre class="bbcode">
res = net_fcntl (s, F_GETFL, 0);
res = net_fcntl (s, F_SETFL, res | 4);
</pre>]]></description>
<dc:creator>dhewg</dc:creator>
<category>Coding</category><pubDate>Mon, 19 Jan 2009 00:35:47 +0100</pubDate></item>
<item>
<guid>http://forum.wiibrew.org/read.php?11,8253,8253#msg-8253</guid>
<title>Non-Blocking Sockets?</title><link>http://forum.wiibrew.org/read.php?11,8253,8253#msg-8253</link><description><![CDATA[ Hello all,<br /><br />I&#039;m having issues setting my TCP and UDP sockets to non-blocking. Is this an issue in the current libraries, is there a work around or am I doing something wrong. Here&#039;s my code for the connection socket. I browsed around the forum and found another post from months ago that said non-blocking sockets did not work, but nobody commented.<br /><br /><pre class="bbcode">
int client_connect(char* ip,int protocol)
{
    c_protocol = protocol;

    net_init();

    client_connected = false;
    connection_socket = net_socket(AF_INET, protocol == TCP ? SOCK_STREAM : SOCK_DGRAM,IPPROTO_IP);
    if (connection_socket == 0) return 0;

    memset(&client,0, sizeof(client));

    client.sin_addr.s_addr = inet_addr(ip);

    client.sin_family = AF_INET;
    client.sin_port = htons(CON_PORT);

    if(protocol == TCP)
        if (net_connect(connection_socket,(struct sockaddr*)&client,sizeof(client)) != 0) return 0;


    unsigned long flag = O_NONBLOCK;
    net_ioctl(connection_socket, FIONBIO, &flag);

    client_connected = true;
    mode = CLIENT;

    return 1;
}
</pre>]]></description>
<dc:creator>scanff</dc:creator>
<category>Coding</category><pubDate>Mon, 19 Jan 2009 00:32:57 +0100</pubDate></item>
</channel>
</rss>