Communications/Transactions : User Guide : Server programming with basic VA Smalltalk
Server programming with basic VA Smalltalk
If you want to build a server application you will need to write Smalltalk scripts. You cannot do it using VA Smalltalk parts alone. Scripts enable you to handle the creation of new processes for each client session.
The following example code processes incoming calls for a Smalltalk server application using APPC for its communications. The code starts a new process each time a call is received.
self continueServer whileTrue: [
conversation := AbtAPPCLocalTP receiveAllocate: 'ServerTpName'.
conversation isCommunicationsError
ifFalse: [
[self handleClient: conversation ] fork
]
]
The continueServer method returns a true if you want to continue processing requests, and a false if you want to end the server. The handleClient method will handle the exchanges for a single client such as, receiving a request, performing logic, sending a reply, and disconnecting the session.
Note:
The methods continueServer and handleClient are used for example purposes only, and their implementation will vary with the communications protocol being used. These methods do not exist in the Smalltalk code; if you want to use them, you must write them yourself.
See FORM='TEXTONLY'. and TCP/IP for sample server applications.
Last modified date: 10/06/2020