For this exercise a program is open a socket to localhost on port 256 and send the message "hello socket world" before closing the socket.

Catching any exceptions or errors is not required.




 
use Net;
 
bundle Default {
  class Socket {
    function : Main(args : String[]) ~ Nil {
      socket := TCPSocket->New("localhost", 256);
      if(socket->IsOpen()) {
        socket->WriteString("hello socket world");
        socket->Close();
      }
    }
  }
}
 