* 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$
* -------------------------------------------------------------------------
*/
#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.
}
}
+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); \