+// --------------------------------------------------------------
+// wxDatagramSocket
+// --------------------------------------------------------------
+
+/* NOTE: experimental stuff - might change */
+
+wxDatagramSocket::wxDatagramSocket( wxSockAddress& addr, wxSockFlags flags )
+ : wxSocketBase( flags, SOCK_DATAGRAM )
+{
+ // Create the socket
+ m_socket = GSocket_new();
+
+ if(!m_socket)
+ return;
+
+ // Setup the socket as non connection oriented
+ GSocket_SetLocal(m_socket, addr.GetAddress());
+ if( GSocket_SetNonOriented(m_socket) != GSOCK_NOERROR )
+ {
+ GSocket_destroy(m_socket);
+ m_socket = NULL;
+ return;
+ }
+
+ // Initialize all stuff
+ m_connected = FALSE;
+ m_establishing = FALSE;
+ GSocket_SetTimeout( m_socket, m_timeout );
+ GSocket_SetCallback( m_socket, GSOCK_INPUT_FLAG | GSOCK_OUTPUT_FLAG |
+ GSOCK_LOST_FLAG | GSOCK_CONNECTION_FLAG,
+ wx_socket_callback, (char*)this );
+
+}
+
+wxDatagramSocket& wxDatagramSocket::RecvFrom( wxSockAddress& addr,
+ char* buf,
+ wxUint32 nBytes )
+{
+ Read(buf, nBytes);
+ GetPeer(addr);
+ return (*this);
+}
+
+wxDatagramSocket& wxDatagramSocket::SendTo( wxSockAddress& addr,
+ const char* buf,
+ wxUint32 nBytes )
+{
+ GSocket_SetPeer(m_socket, addr.GetAddress());
+ Write(buf, nBytes);
+ return (*this);
+}
+