B4J Question ServerSocket, switch client socket to TLS

geekychimp

New Member
Licensed User
I have a (legacy) solution written several years ago in VB.net which is an SMTP server. Part of the solution includes responding to the STARTTLS command which effectively converts the active client socket from plain to SSL.

I'm looking to convert this to B4J, and have created a very simple server based on MJPEG_CCTV with a ServerSocket, and the custom client class.

Can a client be converted from plain to SSL whilst connected?
 

Erel

B4X founder
Staff member
Licensed User
Longtime User
Not trivial but possible.

1629300282873.png


These are the logs of a minimal implementation of SMTP client with STARTTLS. It requires an update to AsyncStreams as we need to stop it without closing the underlying sockets.
I will post it tomorrow.
 
Upvote 0

Erel

B4X founder
Staff member
Licensed User
Longtime User

I haven't tested it in server mode. It might required setting setUseClientMode to False (see the comment in the code).
 
Upvote 0
Top