Closed dragokas closed 4 years ago
CloseEvent
too. (You can remove Close
event impl as there is no Close
event at all).cAsyncSocket
(or cTlsSocket
) to establish socket connectionscTlsSocket
is source-compatible with cAsyncSocket
meaning that if some code is using plain TCP connections with cAsyncSocket
it can easily be migrated to TLS secured ones by just replacing the socket class w/ cTlsSocket
.
Btw, there is a long-standing TODO to migrate chat sample to optional secure sockets w/ cTlsSocket
. Unfortunately DTLS (the TLS over UDP) is not implemented yet.
I see, thanks. Unfortunately, I don't familiar with old known socket control. But, I see the reason :) Сonveniently +1
However, what if the main thread busy with some time-consuming operation, let's say 1 sec (or some amount of time > timeout), and during this time net packet is incoming? Does user control version have a benefit in such case? I didn't test yet this case, though.
When main UI thread is busy no socket events can be received on this main UI thread so communication is paused until main thread can pump messages (becomes available) again. There is no difference in this behavior between MS Winsock controll, cAsyncSocket class and ctxWinsock replacement control.
Updated GET samples. Thanks a lot for your detailed explanation in PM.
Remains to do a fix for HTTPS to make it work...
In ctxWinsock_DataArrival
you don't need ctxWinsock.PeekData sBuffer
before call to actual GetData
method.
The PeekData
method only peeks at recv buffer without removing the data from recv buffer. It is left in sample probably because I've been debugging it. Sorry about that!
Project added under samples
directory in 4dc96d32677ef7f473d180b922a6ab543647683e
10x!
Suggestion:
to have more minimalistic samples. Projects attached. Winsock-simple.zip
Also, don't you mind to clarify:
1) do I correctly stop the connection:
2) Comparing to Chat\Project1.vbp sample, where user control is not used, what is a difference? Is that mean, it is not multithreaded, so some side-effects are expected?
Thank you.