[ << ] [ < ] [ Up ] [ > ] [ >> ]         [Top] [Contents] [Index] [ ? ]

9.1 Opening and Connecting a Client Socket

To open a client socket and connect to it, you will need to call the OPEN command and the USE command:

  ;
  ; Set socket read terminator to LF
  ;
  SET ^$DEVICE(100,"TERMINATOR")=$C(10)
  ;
  ; Open an IPv4 TCP socket to mail.mydomain.com on port 25 (SMTP)
  ; and connect to it
  ;
  OPEN 100:"mail.mydomain.com:25:IPV4:TCP"
  USE 100:/CONNECT
  ;
  ; Read a line of input from the remote host and write it to the terminal
  ;
  NEW LINE
  READ LINE
  USE 0
  WRITE LINE,!
  ;
  ; CLOSE the socket and disconnect
  ;
  CLOSE 100
  QUIT

This document was generated on January 3, 2022 using texi2html 5.0.