wxSocketBase Can be FullDuplex ? Topic is solved

If you are using the main C++ distribution of wxWidgets, Feel free to ask any question related to wxWidgets development here. This means questions regarding to C++ and wxWidgets, not compile problems.
Post Reply
alcindo
In need of some credit
In need of some credit
Posts: 7
Joined: Thu Jul 05, 2007 2:35 pm
Location: Brasil
Contact:

wxSocketBase Can be FullDuplex ?

Post by alcindo » Thu Jul 05, 2007 3:04 pm

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)

krzysiek_t
Earned a small fee
Earned a small fee
Posts: 23
Joined: Tue Jul 11, 2006 1:36 pm
Location: Poland, Warsaw
Contact:

Post by krzysiek_t » Fri Jul 06, 2007 1:00 pm

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.

Post Reply