New paste Repaste Download
using System.Net;
using System.Net.Sockets;
using System.Text;
IPAddress ip = IPAddress.Parse("127.0.0.1");
IPEndPoint ep = new IPEndPoint(ip, 1024);
Socket s = new Socket(AddressFamily.InterNetwork,
    SocketType.Stream, ProtocolType.IP);
s.Bind(ep);
s.Listen(10);
try
{
    while (true)
    {
        Socket ns = s.Accept();
        Console.WriteLine(ns.RemoteEndPoint.ToString());
        ns.Send(Encoding.ASCII.GetBytes(DateTime.Now.ToString()));
        ns.Shutdown(SocketShutdown.Both);
        ns.Close();
    }
}
catch (SocketException ex)
{
    Console.WriteLine(ex.Message);
}
Filename: None. Size: 615b. View raw, , hex, or download this file.

This paste expires on 2024-05-19 15:49:49.466979. Pasted through web.