more info on wxSOCKET_IOERR

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
mael15
Super wx Problem Solver
Super wx Problem Solver
Posts: 449
Joined: Fri May 22, 2009 8:52 am
Location: Bremen, Germany

more info on wxSOCKET_IOERR

Post by mael15 » Fri Mar 20, 2020 2:53 pm

hi everyone,

I am getting unpredictable wxSOCKET_IOERR and struggle to get to the bottom of this. How can I get more information, i.e. was there a buffer problem? Which side of the TCP connection produced the error?
Another thing: to reduce problems I started securing socket access by different threads with wxMutex. This sometimes leads to a freeze when one thread is in wxSocketBase::WaitForRead() after locking the mutex and another thread tries to lock this mutex. So I was wondering: what kinds of socket access need to be secured by a mutex? maybe only Read and Write, not WaitForRead and LastReadCount? Or does reading and writing one socket have to be exclusive at all?

Basics: I communicate with a device via three threads on Windows: SettingsWriteThread, SettingsReadThread and DataThread using one socket for the settings and one for the data coming from the device.
Thanx!

mael15
Super wx Problem Solver
Super wx Problem Solver
Posts: 449
Joined: Fri May 22, 2009 8:52 am
Location: Bremen, Germany

Re: more info on wxSOCKET_IOERR

Post by mael15 » Fri Apr 03, 2020 1:37 pm

hmmmm, seems to be as tricky as it appears?

User avatar
doublemax
Moderator
Moderator
Posts: 15267
Joined: Fri Apr 21, 2006 8:03 pm
Location: $FCE2

Re: more info on wxSOCKET_IOERR

Post by doublemax » Fri Apr 03, 2020 3:28 pm

I don't know much about sockets, my feeling tells me that separate threads for reading and writing should work without a mutex. But i also think one thread per socket would be nicer ;)

Try asking on the wx-users group where you can reach the core wx devs:
https://groups.google.com/forum/#!forum/wx-users
Use the source, Luke!

Post Reply