+ m_socket->SetNonBlocking(1);
+
+ // Reuse makes sense for clients too, if we are trying to rebind to the same port
+ if (GetFlags() & wxSOCKET_REUSEADDR)
+ {
+ m_socket->SetReusable();
+ }
+ if (GetFlags() & wxSOCKET_BROADCAST)
+ {
+ m_socket->SetBroadcast();
+ }
+ if (GetFlags() & wxSOCKET_NOBIND)
+ {
+ m_socket->DontDoBind();
+ }
+
+ // If no local address was passed and one has been set, use the one that was Set
+ if (!local && m_localAddress.GetAddress())
+ {
+ local = &m_localAddress;
+ }
+
+ // Bind to the local IP address and port, when provided
+ if (local)
+ {
+ GAddress* la = local->GetAddress();
+
+ if (la && la->m_addr)
+ m_socket->SetLocal(la);
+ }
+
+#if defined(__WXMSW__) || defined(__WXGTK__)
+ m_socket->SetInitialSocketBuffers(m_initialRecvBufferSize, m_initialSendBufferSize);
+#endif