Reading/Writing Sockets 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
miclus
Can't get richer than this
Can't get richer than this
Posts: 747
Joined: Tue Mar 31, 2009 2:11 am

Reading/Writing Sockets

Post by miclus »

Hi. It seems like when I read and write to a socket, if I don't do the version that waits for everything, things don't always arrive. But, it freezes my application while it's doing it. What is the best way to send and receive information with sockets while not freezing the GUI?
Romas
I live to help wx-kind
I live to help wx-kind
Posts: 176
Joined: Mon Jun 16, 2008 11:07 am
Location: Kaunas

Post by Romas »

It depends of what are you trying to achieve.

If you use non-blocking socket, you can always check if data is arrived and the amount of arrived data. However, you will need to use additional internal buffer to hold all data that is arrived.

Think in this way, you want to get 1mb of data. You need to hold this data in memory/file while the arriving chunks are only 1kb.
Everything requires a line of code.
Post Reply