SSL Server Workspace
"Make sure that vast_server.pem and vast_server_key.pem are in a directory of your choice and referenced in <dir>.
The following example uses Unix style path separators."
| config anSciSocketAddress listenSocket secureSocket rv msg |
 
[config := SciSslSocketConfiguration new
certificateFilename: '<dir>/vast_server.pem';
privateKeyFilename: '<dir>/vast_server_key.pem';
sslVersion: 'TLS';
yourself.
anSciSocketAddress := (SciSocketAddress new)
address: SciSocketConstants::INADDRANY;
port: 4433.
listenSocket := SciSslSocket newStreamSocket.
(rv := listenSocket bind: anSciSocketAddress) isSciError
ifTrue: [ self halt ].
(rv := listenSocket listen: 5) isSciError ifTrue: [ self halt ].
(secureSocket := listenSocket accept) isSciError ifTrue: [ self halt ].
listenSocket close.
(rv := secureSocket sslInitialize: config) isSslError
ifTrue: [ secureSocket close. self halt ].
(rv := secureSocket sslAccept) isSslError
ifTrue: [ secureSocket close. self halt ].
msg := ByteArray new: 4096.
(rv := secureSocket recv: msg length: 4096 startingAt: 1 flags: 0)
isSslError ifTrue: [ self halt ].
Transcript cr; nextPutAll: 'SslServer Got: ', msg asString.
rv := secureSocket
send: 'I hear you.' abrAsPSZ
length: 11
startingAt: 1
flags: 0.
rv isSslError ifTrue: [ self halt ].
secureSocket close. ] fork
Last modified date: 11/06/2015