VbAsyncSocket icon indicating copy to clipboard operation
VbAsyncSocket copied to clipboard

Problems using TLSsocketz

Open LGeyer opened this issue 1 year ago • 11 comments

I created an application on XP which is then tested (and running) on W7, W10 and W11. It sends and reads mails using pop3 and smtp. Now I wanted to convert to vbAsyncSocket to be able to use SSL and TLS1.2. However I found some differences:

  • the events datarrival and sendprogress are not available
  • the error events uses different parameters What can I do?

If necessary I can send you the sources of my classes. (comments are some times in german)

LGeyer avatar Dec 07 '23 20:12 LGeyer

Do you currently use Winsock conrol to send/read mails using pop3 and smtp?

There is a ctxWinsock replacement control under Contrib directory of the repo which has the same properties, methods and events you are looking for:

Event Connect()
Event CloseEvent()
Event ConnectionRequest(ByVal requestID As Long)
Event DataArrival(ByVal bytesTotal As Long)
Event SendProgress(ByVal bytesSent As Long, ByVal bytesRemaining As Long)
Event SendComplete()
Event Error(ByVal Number As Long, Description As String, ByVal Scode As UcsErrorConstants, Source As String, HelpFile As String, ByVal HelpContext As Long, CancelDisplay As Boolean)

Using an ActiveX control for networking operations is highly not recommended so best would be to migrate everything (eventually) to cTlsSocket class.

wqweto avatar Dec 08 '23 11:12 wqweto

No, I don't use Winsock, I use CSocketMaster V1.5, created by Emiliano Scavuzzo. It's description: Winsock api implementation class. So I have to rewrite the methods and event interface?

LGeyer avatar Dec 08 '23 15:12 LGeyer

So I have to rewrite the methods and event interface?

Another option is to implement a CSocketMaster replacement class which uses cTlsSocket class internally the way ctxWinsock is implemented so that you don't have to rewrite your client code but just plug in the replacement class instead.

You don't have to implement all methods/properties of CSocketMaster but just the ones you use in your client code.

p.s. Btw, cTlsSocket supports both TLS and non-encrypted traffic so it's easier to migrate projects to TLS from current non-encrypted situation using it.

wqweto avatar Dec 08 '23 16:12 wqweto

Btw, I can only find V1.3 of CSocketMaster here.

Will try make a replacement class based on this version soon. The properties/methods look very much like Winsock control ones.

wqweto avatar Dec 11 '23 11:12 wqweto

There is a new cTlsRemaster.cls addition just landed to contrib directory which is a CSocketMaster replacement class which keeps the signature of properties, methods and events the same as original.

Should be able to use it as a drop-in replacement in your sources, just add cTlsRemaster.cls, cTlsSocket.cls, cAsyncSocket.cls and mdTlsNative.bas source files to your project.

If you need this compiled in a binary let me know and I'll make a separate Ax-DLL project the way other binaries get compiled as Assets under the repository's releases section.

wqweto avatar Dec 12 '23 10:12 wqweto

Sorry for the long delay... You can load version 1.5 of CSocketMaster from https://telmarkt.de/dload/CSocketMaster15.cls

LGeyer avatar Dec 26 '23 15:12 LGeyer

Using an ActiveX control for networking operations is highly not recommended so best would be to migrate everything (eventually) to cTlsSocket class.

Why not recommended?

LGeyer avatar Dec 26 '23 15:12 LGeyer

Why not recommended?

Because GUI has nothing to do with networking per se. Using invisible controls on forms is a late century "invention" which was amusing and cool when VBX components first appeared.

Nowadays you don't want to use a form to host a control for your networking protocol needs. You just use a regular class (or a module) to encapsulate functionality.

wqweto avatar Dec 27 '23 15:12 wqweto

I assume cTlsSocket can be used to convert from FTP to SFTP too? I just got a message from our service provider that they will switch to SFTP on August, 31st.

LGeyer avatar Jan 03 '24 15:01 LGeyer

I assume cTlsSocket can be used to convert from FTP to SFTP too?

No. SFTP has nothing to do with FTP protocol. It's an SSH based sub-protocol.

It is FTPS to FTP the way HTTPS is to HTTP i.e. the same protocol w/ TLS transport security.

wqweto avatar Jan 03 '24 16:01 wqweto

Unfortunately I am not very familiary with network protocols. What do I have to do to convert from FTP to Secure FTP? Where is FTPS used?

LGeyer avatar Jan 03 '24 18:01 LGeyer