Click here to Skip to main content
15,920,896 members
Home / Discussions / C#
   

C#

 
Questionexceptions Pin
aratireddy1-Mar-09 19:05
aratireddy1-Mar-09 19:05 
AnswerRe: exceptions Pin
ABitSmart1-Mar-09 19:31
ABitSmart1-Mar-09 19:31 
QuestionVoice conference application Pin
yesu prakash1-Mar-09 18:59
yesu prakash1-Mar-09 18:59 
AnswerRe: Voice conference application Pin
ABitSmart1-Mar-09 19:37
ABitSmart1-Mar-09 19:37 
GeneralRe: Voice conference application Pin
yesu prakash1-Mar-09 19:49
yesu prakash1-Mar-09 19:49 
GeneralRe: Voice conference application Pin
ABitSmart1-Mar-09 19:56
ABitSmart1-Mar-09 19:56 
QuestionLIB file error Pin
milapjp1-Mar-09 18:09
milapjp1-Mar-09 18:09 
Questionclosing tcp where socket is connected Pin
A_A1-Mar-09 17:49
A_A1-Mar-09 17:49 
hi all ...
I found that alot of (server , client) applications have this part of code in the "server"

<br />
void StartMethod()<br />
        {<br />
<br />
<br />
            mytcpl = new TcpListener(5020);         // Open The Port<br />
            mytcpl.Start();                         // Start Listening on That Port<br />
            mysocket = mytcpl.AcceptSocket(); // Accept Any Request From Client and Start a Session<br />
            myns = new NetworkStream(mysocket);     // Receives The Binary Data From Port<br />
            mysr = new StreamReader(myns);             // Convert Received Data to String<br />
            string order = mysr.ReadLine();<br />
            if (order == "SD")<br />
               <br />
            // we can add anything here<br />
          <br />
<br />
            else MessageBox.Show(order + " Request Not Found");<br />
            mytcpl.Stop();                             // Close TCP Session<br />
//when stop the tcp listener doesn't that mean that we stop 'disconnect' the socket<br />
<br />
// SO, WHY DO WE CHECK THE SOCKET HERE<br />
<br />
   <br />
<big>if (mysocket.Connected == true)//Looping While Connected to Receive Another Message<br />
            {<br />
                while (true)<br />
                {<br />
                    StartMethod();                     // Back to First Method<br />
                }<br />
            }<br />
        }</big><br />


the Question is :
why to check if the 'socket' is connected where it is already closed by stoping the 'TCP Listener' ?

thanx
AnswerRe: closing tcp where socket is connected Pin
Bharat Jain1-Mar-09 20:42
Bharat Jain1-Mar-09 20:42 
JokeRe: closing tcp where socket is connected Pin
A_A2-Mar-09 3:37
A_A2-Mar-09 3:37 
Questionadd image into image list using image index ( problem) Pin
S K Y1-Mar-09 15:11
S K Y1-Mar-09 15:11 
AnswerRe: add image into image list using image index ( problem) Pin
Luc Pattyn1-Mar-09 16:22
sitebuilderLuc Pattyn1-Mar-09 16:22 
GeneralRe: add image into image list using image index ( problem) Pin
S K Y1-Mar-09 21:07
S K Y1-Mar-09 21:07 
AnswerRe: add image into image list using image index ( problem) Pin
Luc Pattyn2-Mar-09 2:24
sitebuilderLuc Pattyn2-Mar-09 2:24 
QuestionDrag Drop Problem Pin
S K Y1-Mar-09 14:28
S K Y1-Mar-09 14:28 
AnswerRe: Drag Drop Problem Pin
STeAlth-S1-Mar-09 18:15
STeAlth-S1-Mar-09 18:15 
GeneralRe: Drag Drop Problem Pin
S K Y1-Mar-09 20:49
S K Y1-Mar-09 20:49 
GeneralRe: Drag Drop Problem Pin
STeAlth-S1-Mar-09 23:03
STeAlth-S1-Mar-09 23:03 
GeneralRe: Drag Drop Problem Pin
S K Y2-Mar-09 2:03
S K Y2-Mar-09 2:03 
QuestionWhat the heck? Pin
Paul Brower1-Mar-09 14:15
Paul Brower1-Mar-09 14:15 
AnswerRe: What the heck? Pin
Luc Pattyn1-Mar-09 14:23
sitebuilderLuc Pattyn1-Mar-09 14:23 
QuestionIndexOf returns wrong value if the string to search for contains characters from the Latin Extended-C range Pin
Gerard van Wilgen1-Mar-09 9:34
Gerard van Wilgen1-Mar-09 9:34 
AnswerRe: IndexOf returns wrong value if the string to search for contains characters from the Latin Extended-C range Pin
Luc Pattyn1-Mar-09 13:18
sitebuilderLuc Pattyn1-Mar-09 13:18 
GeneralRe: IndexOf returns wrong value if the string to search for contains characters from the Latin Extended-C range Pin
Gerard van Wilgen2-Mar-09 10:32
Gerard van Wilgen2-Mar-09 10:32 
Questionproblems creating setup for C# application Pin
laziale1-Mar-09 8:28
laziale1-Mar-09 8: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.