]> git.saurik.com Git - wxWidgets.git/blobdiff - src/common/socket.cpp
fixed Freeze/Thaw() for wxCombobox (patch 925808)
[wxWidgets.git] / src / common / socket.cpp
index 3706c62893274dda7eeae6c674d28fad06257e05..5e8f4ff8dec23f8d9196be1dd529c7b28ef55a30 100644 (file)
@@ -54,7 +54,7 @@ WX_CHECK_BUILD_OPTIONS("wxNet")
 
 // what to do within waits: we have 2 cases: from the main thread itself we
 // have to call wxYield() to let the events (including the GUI events and the
-// low-level (not wxWindows) events from GSocket) be processed. From another
+// low-level (not wxWidgets) events from GSocket) be processed. From another
 // thread it is enough to just call wxThread::Yield() which will give away the
 // rest of our time slice: the explanation is that the events will be processed
 // by the main thread anyhow, without calling wxYield(), but we don't want to
@@ -678,6 +678,10 @@ bool wxSocketBase::_Wait(long seconds,
   else
     timeout = m_timeout * 1000;
 
+#if !defined(wxUSE_GUI) || !wxUSE_GUI
+  GSocket_SetTimeout(m_socket, timeout);
+#endif 
+
   // Wait in an active polling loop.
   //
   // NOTE: We duplicate some of the code in OnRequest, but this doesn't
@@ -750,6 +754,7 @@ bool wxSocketBase::WaitForRead(long seconds, long milliseconds)
                                       GSOCK_LOST_FLAG);
 }
 
+
 bool wxSocketBase::WaitForWrite(long seconds, long milliseconds)
 {
   return _Wait(seconds, milliseconds, GSOCK_OUTPUT_FLAG);
@@ -1122,6 +1127,27 @@ bool wxSocketServer::WaitForAccept(long seconds, long milliseconds)
   return _Wait(seconds, milliseconds, GSOCK_CONNECTION_FLAG);
 }
 
+bool wxSocketBase::GetOption(int level, int optname, void *optval, int *optlen)
+{
+    if (GSocket_GetSockOpt(m_socket, level, optname, optval, optlen) 
+        != GSOCK_NOERROR)
+    {
+        return FALSE;
+    }
+    return TRUE;
+}
+
+bool wxSocketBase::SetOption(int level, int optname, const void *optval, 
+                              int optlen)
+{
+    if (GSocket_SetSockOpt(m_socket, level, optname, optval, optlen) 
+        != GSOCK_NOERROR)
+    {
+        return FALSE;
+    }
+    return TRUE;
+}
+
 // ==========================================================================
 // wxSocketClient
 // ==========================================================================
@@ -1217,9 +1243,12 @@ wxDatagramSocket::wxDatagramSocket( wxSockAddress& addr,
   m_socket = GSocket_new();
 
   if(!m_socket)
+  {
+    wxASSERT_MSG( 0, _T("datagram socket not new'd") );
     return;
-
+  }
   // Setup the socket as non connection oriented
+  GSocket_Unstreamed(m_socket);
   GSocket_SetLocal(m_socket, addr.GetAddress());
   if( GSocket_SetNonOriented(m_socket) != GSOCK_NOERROR )
   {