Following is a very simple demonstration program that will send a fixed-length string to a server and receive the same string echoed back. We create three XMLSocket callback functions to handle onOpen, onClose, and onXML events. A fourth function is attached to a submit button. This submit() function packages the input text into XML and transmits it to the server using XMLSocket.send().
socko= new XMLSocket(); |