Initial data commit
This commit is contained in:
parent
72d218235f
commit
f23f22d71c
199087 changed files with 3378941 additions and 0 deletions
|
|
@ -0,0 +1,27 @@
|
|||
using System.Text;
|
||||
using System.Net.Sockets;
|
||||
using System.Net;
|
||||
|
||||
namespace WebServer
|
||||
{
|
||||
class GoodByeWorld
|
||||
{
|
||||
static void Main(string[] args)
|
||||
{
|
||||
const string msg = "<html>\n<body>\nGoodbye, world!\n</body>\n</html>\n";
|
||||
const int port = 8080;
|
||||
bool serverRunning = true;
|
||||
|
||||
TcpListener tcpListener = new TcpListener(IPAddress.Any, port);
|
||||
tcpListener.Start();
|
||||
|
||||
while (serverRunning)
|
||||
{
|
||||
Socket socketConnection = tcpListener.AcceptSocket();
|
||||
byte[] bMsg = Encoding.ASCII.GetBytes(msg.ToCharArray(), 0, (int)msg.Length);
|
||||
socketConnection.Send(bMsg);
|
||||
socketConnection.Disconnect(true);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue