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.




using System.Text;
using System.Net.Sockets;
 
module Program
{
    Main() : void
    {
        def sock = Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp);
        sock.Connect("127.0.0.1", 1000);
        _ = sock.Send(Encoding.ASCII.GetBytes("Hell, world!"));
        sock.Close();
    }
}