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

C#, 284 283 282 278 274274 254 bytes

class A{static int Main(string[]a){var b=new System.Net.Sockets.TcpListener(int.Parse(a[0]));b.Start();for(;;)using({var c=b.AcceptTcpClient())using(var;var d=newd=c.Client.LocalEndPoint.Serialize();new System.IO.StreamWriter(c.GetStream())){var e=c.Client.LocalEndPoint.Serialize();d.WriteLine(e[4]+e[5]+e[6]+e[7]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:

C#, 284 283 282 278 274 bytes

class A{static int Main(string[]a){var b=new System.Net.Sockets.TcpListener(int.Parse(a[0]));b.Start();for(;;)using(var c=b.AcceptTcpClient())using(var d=new System.IO.StreamWriter(c.GetStream())){var e=c.Client.LocalEndPoint.Serialize();d.WriteLine(e[4]+e[5]+e[6]+e[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:

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:

deleted 60 characters in body
Source Link
LegionMammal978
  • 18.2k
  • 4
  • 25
  • 58

C#, 284 283 282 278278 274 bytes

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

Classic example of a basic C# TCP server. Don't run this for too many clients, as it leaks memory (I think). 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:

C#, 284 283 282 278 bytes

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

Classic example of a basic C# TCP server. Don't run this for too many clients, as it leaks memory (I think). 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:

C#, 284 283 282 278 274 bytes

class A{static int Main(string[]a){var b=new System.Net.Sockets.TcpListener(int.Parse(a[0]));b.Start();for(;;)using(var c=b.AcceptTcpClient())using(var d=new System.IO.StreamWriter(c.GetStream())){var e=c.Client.LocalEndPoint.Serialize();d.WriteLine(e[4]+e[5]+e[6]+e[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:

added 7 characters in body
Source Link
LegionMammal978
  • 18.2k
  • 4
  • 25
  • 58

C#, 284 283 282282 278 bytes

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

Classic example of a basic C# TCP server. Don't run this for too many clients, as it leaks memory (I think). 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:

C#, 284 283 282 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();var e=new System.IO.StreamWriter(c.GetStream());e.WriteLine(d[4]+d[5]+d[6]+d[7]);e.Flush();c.Close();}}} 

Classic example of a basic C# TCP server. Don't run this for too many clients, as it leaks memory (I think). 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:

C#, 284 283 282 278 bytes

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

Classic example of a basic C# TCP server. Don't run this for too many clients, as it leaks memory (I think). 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:

added 10 characters in body
Source Link
LegionMammal978
  • 18.2k
  • 4
  • 25
  • 58
Loading
added 10 characters in body
Source Link
LegionMammal978
  • 18.2k
  • 4
  • 25
  • 58
Loading
Source Link
LegionMammal978
  • 18.2k
  • 4
  • 25
  • 58
Loading