Reading/Writing Sockets Topic is solved
Reading/Writing Sockets
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?
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.
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.