Skip to main content
6 of 6
deleted 9 characters in body
LegionMammal978
  • 18.2k
  • 4
  • 25
  • 58

C#, 284 283 282 278 274 254 bytes

class A{static int Main(string[]a){var b=new System.Net.Sockets.TcpListener(int.Parse(a[0]));b.Start();for(;;){var c=b.AcceptTcpClient();var d=c.Client.LocalEndPoint.Serialize();new System.IO.StreamWriter(c.GetStream()).WriteLine(d[4]+d[5]+d[6]+d[7]);}}} 

Classic example of a basic C# TCP server. Testing:

Terminal 1:

$ ./Q76379.exe 1029 

Terminal 2:

$ telnet localhost 1029 Trying 127.0.0.1... Connected to localhost. Escape character is '^]'. 128 Connection closed by foreign host. 

Firefox:

LegionMammal978
  • 18.2k
  • 4
  • 25
  • 58