Click here to Skip to main content
15,888,590 members
Home / Discussions / C#
   

C#

 
AnswerRe: code for drag & drop of tools in c#.net Pin
Christian Graus1-Mar-09 21:45
protectorChristian Graus1-Mar-09 21:45 
Questionplease urgent..... Pin
meenatiruppathi1-Mar-09 20:26
meenatiruppathi1-Mar-09 20:26 
AnswerRe: please urgent..... Pin
0x3c01-Mar-09 20:29
0x3c01-Mar-09 20:29 
AnswerRe: please urgent..... Pin
Christian Graus1-Mar-09 21:43
protectorChristian Graus1-Mar-09 21:43 
AnswerRe: please urgent..... Pin
Vikram A Punathambekar1-Mar-09 21:43
Vikram A Punathambekar1-Mar-09 21:43 
Questionhow to prevent user created ports being restricted by antivirus software Pin
prasadbuddhika1-Mar-09 20:23
prasadbuddhika1-Mar-09 20:23 
AnswerRe: how to prevent user created ports being restricted by antivirus software Pin
0x3c01-Mar-09 20:27
0x3c01-Mar-09 20:27 
Questionpaint APPLICATION code in "C# NET" Pin
poonam jagdale1-Mar-09 20:21
poonam jagdale1-Mar-09 20:21 
AnswerRe: paint APPLICATION code in "C# NET" Pin
0x3c01-Mar-09 20:24
0x3c01-Mar-09 20:24 
Questionexe files Pin
mrithula81-Mar-09 19:57
mrithula81-Mar-09 19:57 
AnswerRe: exe files Pin
Christian Graus1-Mar-09 20:08
protectorChristian Graus1-Mar-09 20:08 
QuestionField Link in Datagrid Pin
Ramkithepower1-Mar-09 19:38
Ramkithepower1-Mar-09 19:38 
AnswerRe: Field Link in Datagrid Pin
0x3c01-Mar-09 20:35
0x3c01-Mar-09 20:35 
Question# I/O operatinons Pin
shefa' isied1-Mar-09 19:37
shefa' isied1-Mar-09 19:37 
AnswerRe: # I/O operatinons Pin
Christian Graus1-Mar-09 19:40
protectorChristian Graus1-Mar-09 19:40 
Questiondatagrid Pin
cst_kvp1-Mar-09 19:21
cst_kvp1-Mar-09 19:21 
AnswerRe: datagrid Pin
Christian Graus1-Mar-09 19:41
protectorChristian Graus1-Mar-09 19:41 
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

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.