I've got a problem with wxSocketClient (derived from wxSocketBase) when trying to use it in full-duplex mode, that is, using Write method when there is an already called Read method, using block mode (wxSOCKET_BLOCK), for waiting some data that may arrive simultaneously with write operation.
Looking for these methods on source code I found that both use m_lcount as an base for setting m_error, but its base class (GSocket) can operate the corresponding methods (GSocket::Read and GSocket::Write) without doing this, but sets its internal error status (m_error) on both. This means that GSocket cannot operate, too, in full-duplex mode as basic socket operations "recv" and "send" can.
Would someone explain why it was done, that is, if there is any reason for turning socket operations into half-duplex mode ? Would it be possible when next version of wxWidgets is released, come with full-duplex operations, separating status and counter on input and output methods ?
In fact I need to do full-duplex operations (Writing when waiting blocked for reading) on the application that I'm developping for running on Windows and LINUX using wxMSW, wxGTK and wxMOTIF, trying to maintain same source code, even if in some cases I have to use "ifdefs".
Thanks for any returns
Cheers,
Alcindo
P.S: wxWidgets is the best portable C++ Framework I've been seen since
I've begin on this work of making software some decades ago...
wxWidgets 2.8.4 (wxMSW, wxGTK and wxMOTIF)
on W2K SP4, WinXP Professional SP2 and Fedora Core 5 and 6.
Using CodeBlocks SVN 3918 IDE (very nice)
wxSocketBase Can be FullDuplex ? Topic is solved
-
- Earned a small fee
- Posts: 23
- Joined: Tue Jul 11, 2006 1:36 pm
- Location: Poland, Warsaw
- Contact:
Well - I'm suprised with your discovery. I'm using wxWidgets for some years, but to be honest, it seems I used it mainly for GUI development.
In general, write and read operation can be done simultanously. I used berkeley sockets few times. My prefered way is blocking mode reading/writing with 2 threads: one for reading - this one sleeps on select() function, and one for writing - this sleeps on a semaphore of some output queue.
In general, write and read operation can be done simultanously. I used berkeley sockets few times. My prefered way is blocking mode reading/writing with 2 threads: one for reading - this one sleeps on select() function, and one for writing - this sleeps on a semaphore of some output queue.