I want to create a website with URL as my IP-address[ex: 192.X.X.X]
That website would respond with a "HELLO THERE" message to any user who accesses my URL.
I use the following code to do this![its just a basic code with no threading]
class listenToHTTP
{
HttpListener _listner;
public void start()
{
_listner = new HttpListener();
_listner.Prefixes.Add("http://localhost/");//default port 80
_listner.Start();
}
public void process()
{
while (true)
{
HttpListenerContext context = _listner.GetContext();
byte[] output = Encoding.ASCII.GetBytes("HELLO THERE");
context.Response.ContentEncoding = Encoding.ASCII;
context.Response.ContentLength64 = output.Length;
context.Response.OutputStream.Write(output, 0, output.Length);
}
}
}
The problem is that i dont know the IP-address through which anyone would access.
It perfectly shows the response "HELLO THERE" when I use http://localhost/ as URL.
But what IP-address would other people use so that they can access my simple website.
I have tried my IP-address in the browser but it doesnt work.