Click here to Skip to main content
15,908,909 members
Home / Discussions / C#
   

C#

 
GeneralRe: PolyGon To Shift Right Pin
Anubhava Dimri10-Apr-11 18:16
Anubhava Dimri10-Apr-11 18:16 
QuestionC# session Pin
adrian salas8-Apr-11 18:09
adrian salas8-Apr-11 18:09 
AnswerRe: C# session Pin
OriginalGriff8-Apr-11 20:36
mveOriginalGriff8-Apr-11 20:36 
GeneralRe: C# session Pin
adrian salas9-Apr-11 3:33
adrian salas9-Apr-11 3:33 
AnswerRe: C# session Pin
Anubhava Dimri8-Apr-11 20:50
Anubhava Dimri8-Apr-11 20:50 
AnswerRe: C# session Pin
dan!sh 9-Apr-11 5:34
professional dan!sh 9-Apr-11 5:34 
AnswerRe: C# session Pin
Ganesh Kumar Kaki13-Apr-11 1:21
Ganesh Kumar Kaki13-Apr-11 1:21 
QuestionWebserver only sending text occasionally? [modified] Pin
venomation8-Apr-11 16:38
venomation8-Apr-11 16:38 
I have the following code (I am learning sockets for the first time):

static void Main()
{
    var listener = new TcpListener(IPAddress.Parse("127.0.0.1"), 80);
    listener.Start();


    bool serverIsOnline = true;
    while (serverIsOnline)
    {
        Console.WriteLine("Polling for a client");
        TcpClient client = listener.AcceptTcpClient();
        Console.WriteLine("Client {0} has connected", client.Client.RemoteEndPoint);

        Console.WriteLine("Handling client");
        serverIsOnline = HandleClient(client);
        Console.WriteLine("Finished handling client");

        Console.WriteLine("Closing client");
        client.Close();
    }
   listener.Stop();

}

private static bool HandleClient(TcpClient client)
{
    using(var writer = new StreamWriter(client.GetStream()))
    {
        writer.WriteLine("Welcome to the system...");
        writer.Flush();
    }
    return true;
}


When I open the browser (firefox and IE) and enter 127.0.0.1 it sometimes displays the welcome message, but it mostly just displays "The connection was reset".
What could be causing this and how would I resolve this issue?

Thanks Big Grin | :-D

modified on Friday, April 8, 2011 10:50 PM

AnswerRe: Webserver only sending text occasionally? Pin
Richard Andrew x649-Apr-11 3:27
professionalRichard Andrew x649-Apr-11 3:27 
GeneralRe: Webserver only sending text occasionally? Pin
venomation9-Apr-11 4:59
venomation9-Apr-11 4:59 
AnswerRe: Webserver only sending text occasionally? Pin
BobJanova11-Apr-11 5:10
BobJanova11-Apr-11 5:10 
QuestionHow to get a value to return in a textbox Pin
Justiin12658-Apr-11 12:15
Justiin12658-Apr-11 12:15 
AnswerRe: How to get a value to return in a textbox Pin
Colin Angus Mackay8-Apr-11 14:15
Colin Angus Mackay8-Apr-11 14:15 
GeneralRe: How to get a value to return in a textbox Pin
Justiin12658-Apr-11 16:28
Justiin12658-Apr-11 16:28 
AnswerRe: How to get a value to return in a textbox Pin
Luc Pattyn8-Apr-11 15:01
sitebuilderLuc Pattyn8-Apr-11 15:01 
GeneralRe: How to get a value to return in a textbox Pin
Justiin12658-Apr-11 16:39
Justiin12658-Apr-11 16:39 
AnswerRe: How to get a value to return in a textbox Pin
Luc Pattyn8-Apr-11 17:10
sitebuilderLuc Pattyn8-Apr-11 17:10 
AnswerRe: How to get a value to return in a textbox Pin
davidnz8-Apr-11 15:32
davidnz8-Apr-11 15:32 
GeneralRe: How to get a value to return in a textbox Pin
Justiin12658-Apr-11 16:44
Justiin12658-Apr-11 16:44 
GeneralRe: How to get a value to return in a textbox Pin
Rotted Frog8-Apr-11 22:29
Rotted Frog8-Apr-11 22:29 
Questionthread.interrupt only working once Pin
Member 74021668-Apr-11 10:40
Member 74021668-Apr-11 10:40 
AnswerRe: thread.interrupt only working once Pin
davidnz8-Apr-11 12:13
davidnz8-Apr-11 12:13 
AnswerRe: thread.interrupt only working once Pin
Ganesh Kumar Kaki13-Apr-11 1:27
Ganesh Kumar Kaki13-Apr-11 1:27 
QuestionGlobal Hook : need help with SysMsgProc Pin
moums8-Apr-11 8:12
moums8-Apr-11 8:12 
QuestionQuerying LDAP from an application: get a search result when one attribute of a multiple attribute matches Pin
Bernhard Hiller8-Apr-11 1:28
Bernhard Hiller8-Apr-11 1:28 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.