]> git.saurik.com Git - wxWidgets.git/blobdiff - src/unix/gsocket.c
compilation fix for a patch which didn't compile...
[wxWidgets.git] / src / unix / gsocket.c
index dd8bfc5a92e504309e5d95f2c5c5b26cf61df6b5..28b5f54307b88a2f2f2ff7056ce8d036fc5b8e7e 100644 (file)
@@ -4,7 +4,7 @@
  * Authors: Guilhem Lavaux,
  *          Guillermo Rodriguez Garcia <guille@iies.es> (maintainer)
  * Purpose: GSocket main Unix and OS/2 file
- * Licence: The wxWindows licence
+ * Licence: The wxWidgets licence
  * CVSID:   $Id$
  * -------------------------------------------------------------------------
  */
@@ -483,11 +483,6 @@ GSocketError GSocket_SetServer(GSocket *sck)
 #endif
   _GSocket_Enable_Events(sck);
 
-  /* allow a socket to re-bind if the socket is in the TIME_WAIT
-     state after being previously closed.
-   */
-  setsockopt(sck->m_fd, SOL_SOCKET, SO_REUSEADDR, (const char*)&arg, sizeof(u_long));
-
   /* Bind to the local address,
    * retrieve the actual address bound,
    * and listen up to 5 connections.
@@ -1129,6 +1124,44 @@ void GSocket_UnsetCallback(GSocket *socket, GSocketEventFlags flags)
   }
 }
 
+GSocketError GSocket_GetSockOpt(GSocket *socket, int level, int optname,
+                                void *optval, int *optlen)
+{
+    if (getsockopt(socket->m_fd, level, optname, optval, optlen) == 0)
+    {
+        return GSOCK_NOERROR;
+    }
+    return GSOCK_OPTERR;
+}
+
+GSocketError GSocket_SetSockOpt(GSocket *socket, int level, int optname, 
+                                const void *optval, int optlen)
+{
+    if (setsockopt(socket->m_fd, level, optname, optval, optlen) == 0)
+    {
+        return GSOCK_NOERROR;       
+    }
+    return GSOCK_OPTERR;
+}
+
+GSocketError GSocket_SetReuseAddr(GSocket *socket)
+{
+  /* allow a socket to re-bind if the socket is in the TIME_WAIT
+     state after being previously closed.
+   */
+  u_long arg = 1;
+  setsockopt(socket->m_fd, SOL_SOCKET, SO_REUSEADDR, (const char*)&arg, sizeof(u_long));
+}
+
+void GSocket_Streamed(GSocket *socket)
+{
+    socket->m_stream = TRUE;
+}
+
+void GSocket_Unstreamed(GSocket *socket)
+{
+    socket->m_stream = FALSE;
+}
 
 #define CALL_CALLBACK(socket, event) {                                  \
   _GSocket_Disable(socket, event);                                      \