- // Initialize all stuff
- m_connected = false;
- m_establishing = false;
- m_socket->SetTimeout( m_timeout );
- m_socket->SetCallback( GSOCK_INPUT_FLAG | GSOCK_OUTPUT_FLAG |
- GSOCK_LOST_FLAG | GSOCK_CONNECTION_FLAG,
- wx_socket_callback, (char*)this );
+ if (!m_socket)
+ {
+ wxFAIL_MSG( _T("datagram socket not new'd") );
+ return;
+ }
+ // Setup the socket as non connection oriented
+ m_socket->SetLocal(addr.GetAddress());
+ if (flags & wxSOCKET_REUSEADDR)
+ {
+ m_socket->SetReusable();
+ }
+ if (GetFlags() & wxSOCKET_BROADCAST)
+ {
+ m_socket->SetBroadcast();
+ }
+ if (GetFlags() & wxSOCKET_NOBIND)
+ {
+ m_socket->DontDoBind();
+ }
+ if ( m_socket->SetNonOriented() != GSOCK_NOERROR )
+ {
+ delete m_socket;
+ m_socket = NULL;
+ return;
+ }