Click here to Skip to main content
16,017,069 members
Home / Discussions / C#
   

C#

 
GeneralRe: Problem with using "out" in void methods Pin
AndyASPVB7-Oct-09 12:00
AndyASPVB7-Oct-09 12:00 
GeneralRe: Problem with using "out" in void methods Pin
Not Active7-Oct-09 12:14
mentorNot Active7-Oct-09 12:14 
AnswerRe: Problem with using "out" in void methods Pin
Saksida Bojan7-Oct-09 10:12
Saksida Bojan7-Oct-09 10:12 
Questionweb and window applications that work on one same database file Pin
Djtech017-Oct-09 8:31
Djtech017-Oct-09 8:31 
AnswerRe: web and window applications that work on one same database file Pin
Christian Graus7-Oct-09 10:00
protectorChristian Graus7-Oct-09 10:00 
GeneralRe: web and window applications that work on one same database file Pin
Djtech018-Oct-09 6:53
Djtech018-Oct-09 6:53 
AnswerRe: web and window applications that work on one same database file Pin
Christian Graus7-Oct-09 11:05
protectorChristian Graus7-Oct-09 11:05 
QuestionWhy server doesn't respond? Pin
Aljaz1117-Oct-09 7:46
Aljaz1117-Oct-09 7:46 
I have made server with this code and in new form. When I push button that loads this form it stops.
private void server_Load(object sender, EventArgs e)
        {
            
            Int32 port = 1111;
            IPAddress localAddr = IPAddress.Parse("127.0.0.1");

            TcpListener tcpListener = new TcpListener(localAddr, port);
            
            tcpListener.Start();
            Console.WriteLine("Strežnik pognan...");
            

            try
            {
                
                    //Sprejemanje novih odjemalcev
                    Socket socketForClient = tcpListener.AcceptSocket();

                    while (true)
                    {
                        if (socketForClient.Connected)
                        {

                            MessageBox.Show("Odjemalec povezan " + socketForClient.RemoteEndPoint.ToString(), "Napaka", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                            NetworkStream networkStream = new NetworkStream(socketForClient);
                            StreamWriter streamWriter = new StreamWriter(networkStream);
                            StreamReader streamReader = new StreamReader(networkStream);
                            string line = streamReader.ReadLine();
                            textBox1.Text = "Sprejeto: " + line;
                            line = line.ToUpper();
                            streamWriter.WriteLine(line);
                            Console.WriteLine("Poslano: " + line);
                            streamWriter.Flush();
                            Console.WriteLine();
                        }
                        socketForClient.Close();
                    }
            }
            catch (Exception x)
            {
                Console.WriteLine(x.ToString());
            }


When i connect client(also new form) to it..client form opens(client connected) but server form still isn't responding. Now i would like to type something in client and this message would be also writen lets say in textbox in server. If i delete while(true) it works but only first time. What should i do that it would work multiple times.

Please help
AnswerRe: Why server doesn't respond? Pin
Luc Pattyn7-Oct-09 9:05
sitebuilderLuc Pattyn7-Oct-09 9:05 
GeneralRe: Why server doesn't respond? Pin
Aljaz1118-Oct-09 0:17
Aljaz1118-Oct-09 0:17 
GeneralRe: Why server doesn't respond? Pin
Luc Pattyn8-Oct-09 1:10
sitebuilderLuc Pattyn8-Oct-09 1:10 
GeneralRe: Why server doesn't respond? [modified] Pin
Aljaz1118-Oct-09 5:31
Aljaz1118-Oct-09 5:31 
GeneralRe: Why server doesn't respond? Pin
Luc Pattyn8-Oct-09 5:49
sitebuilderLuc Pattyn8-Oct-09 5:49 
GeneralRe: Why server doesn't respond? Pin
Aljaz1118-Oct-09 5:55
Aljaz1118-Oct-09 5:55 
QuestionHelp is needed (Urgent) Pin
jashimu7-Oct-09 7:40
jashimu7-Oct-09 7:40 
AnswerRe: Help is needed (Urgent) Pin
EliottA7-Oct-09 9:07
EliottA7-Oct-09 9:07 
QuestionWhat's special with message box? Pin
teknolog1237-Oct-09 6:56
teknolog1237-Oct-09 6:56 
AnswerRe: What's special with message box? Pin
PIEBALDconsult7-Oct-09 7:27
mvePIEBALDconsult7-Oct-09 7:27 
GeneralRe: What's special with message box? [modified] Pin
teknolog1237-Oct-09 7:37
teknolog1237-Oct-09 7:37 
GeneralRe: What's special with message box? Pin
LimitedAtonement7-Oct-09 7:42
LimitedAtonement7-Oct-09 7:42 
GeneralRe: What's special with message box? Pin
teknolog1237-Oct-09 8:09
teknolog1237-Oct-09 8:09 
GeneralRe: What's special with message box? Pin
PIEBALDconsult7-Oct-09 7:42
mvePIEBALDconsult7-Oct-09 7:42 
QuestionAnother method safer than StreamWriter and how can I save the file on another server (asp.net c sharp) Pin
aspkiddy7-Oct-09 6:32
aspkiddy7-Oct-09 6:32 
QuestionCode Readability Poll Pin
LimitedAtonement7-Oct-09 5:57
LimitedAtonement7-Oct-09 5:57 
AnswerRe: Code Readability Poll Pin
Kevin Marois7-Oct-09 6:34
professionalKevin Marois7-Oct-09 6:34 

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.