Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using System.Net;
- using System.Net.Sockets;
- namespace wire
- {
- class Program
- {
- static void Main(string[] args)
- {
- string message = "C# says hello!";
- byte[] data = Encoding.UTF8.GetBytes(message);
- TcpListener server = new TcpListener(80);
- server.Start();
- Console.WriteLine("Waiting for the first connection...");
- while (true)
- {
- using (TcpClient connection = server.AcceptTcpClient())
- {
- Console.WriteLine("Oh! Hello!");
- connection.GetStream().Write(data, 0, data.Length);
- }
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement