-/* GSocket_SetReusable:
-* Simply sets the m_resuable flag on the socket. GSocket_SetServer will
-* make the appropriate setsockopt() call.
-* Implemented as a GSocket function because clients (ie, wxSocketServer)
-* don't have access to the GSocket struct information.
-* Returns true if the flag was set correctly, false if an error occurred
-* (ie, if the parameter was NULL)
-*/
-bool GSocket::SetReusable()
-{
- /* socket must not be null, and must not be in use/already bound */
- if (this && m_fd == INVALID_SOCKET) {
- m_reusable = true;
- return true;
- }
- return false;
-}
-
-/* GSocket_SetBroadcast:
-* Simply sets the m_broadcast flag on the socket. GSocket_SetServer will
-* make the appropriate setsockopt() call.
-* Implemented as a GSocket function because clients (ie, wxSocketServer)
-* don't have access to the GSocket struct information.
-* Returns true if the flag was set correctly, false if an error occurred
-* (ie, if the parameter was NULL)
-*/
-bool GSocket::SetBroadcast()
-{
- /* socket must not be in use/already bound */
- if (m_fd == INVALID_SOCKET) {
- m_broadcast = true;
- return true;
- }
- return false;
-}
-
-bool GSocket::DontDoBind()
-{
- /* socket must not be in use/already bound */
- if (m_fd == INVALID_SOCKET) {
- m_dobind = false;
- return true;
- }
- return false;
-}
-
-/* Client specific parts */
-
-/* GSocket_Connect:
- * For stream (connection oriented) sockets, GSocket_Connect() tries
- * to establish a client connection to a server using the peer address
- * as established with GSocket_SetPeer(). Returns GSOCK_NOERROR if the
- * connection has been successfully established, or one of the error
- * codes listed below. Note that for nonblocking sockets, a return
- * value of GSOCK_WOULDBLOCK doesn't mean a failure. The connection
- * request can be completed later; you should use GSocket_Select()
- * to poll for GSOCK_CONNECTION | GSOCK_LOST, or wait for the
- * corresponding asynchronous events.
- *
- * For datagram (non connection oriented) sockets, GSocket_Connect()
- * just sets the peer address established with GSocket_SetPeer() as
- * default destination.
- *
- * Error codes:
- * GSOCK_INVSOCK - the socket is in use or not valid.
- * GSOCK_INVADDR - the peer address has not been established.
- * GSOCK_TIMEDOUT - timeout, the connection failed.
- * GSOCK_WOULDBLOCK - connection in progress (nonblocking sockets only)
- * GSOCK_MEMERR - couldn't allocate memory.
- * GSOCK_IOERR - low-level error.
- */
-GSocketError GSocket::Connect(GSocketStream stream)