Click here to Skip to main content
15,925,723 members
Home / Discussions / C#
   

C#

 
AnswerRe: Async TcpListener recieves ClientAccept after stoping listening. How to notify it that the client disconnected? Pin
N a v a n e e t h31-Oct-09 18:22
N a v a n e e t h31-Oct-09 18:22 
QuestionRe: Async TcpListener recieves ClientAccept after stoping listening. How to notify it that the client disconnected? Pin
Chesnokov Yuriy31-Oct-09 20:06
professionalChesnokov Yuriy31-Oct-09 20:06 
AnswerRe: Async TcpListener recieves ClientAccept after stoping listening. How to notify it that the client disconnected? Pin
N a v a n e e t h31-Oct-09 21:57
N a v a n e e t h31-Oct-09 21:57 
GeneralRe: Async TcpListener recieves ClientAccept after stoping listening. How to notify it that the client disconnected? [modified] Pin
Chesnokov Yuriy31-Oct-09 23:36
professionalChesnokov Yuriy31-Oct-09 23:36 
QuestionRe: Async TcpListener recieves ClientAccept after stoping listening. How to notify it that the client disconnected? Pin
Chesnokov Yuriy1-Nov-09 0:56
professionalChesnokov Yuriy1-Nov-09 0:56 
AnswerRe: Async TcpListener recieves ClientAccept after stoping listening. How to notify it that the client disconnected? Pin
N a v a n e e t h1-Nov-09 1:32
N a v a n e e t h1-Nov-09 1:32 
AnswerRe: Async TcpListener recieves ClientAccept after stoping listening. How to notify it that the client disconnected? Pin
Chesnokov Yuriy1-Nov-09 2:35
professionalChesnokov Yuriy1-Nov-09 2:35 
QuestionTcpClient does not get disconnected? Pin
Chesnokov Yuriy31-Oct-09 10:37
professionalChesnokov Yuriy31-Oct-09 10:37 
How to notify TcpClient that it is disconnected?

1. I start async TcpListener
2. Once the client is connected it reads all data it sent also in async mode
3. Then simply close NetworkStream and close the client connection

private void TcpListenerDataReadAsyncCallback(IAsyncResult ar)
{
TcpClient tc = (TcpClient)ar.AsyncState;
NetworkStream ns = tc.GetStream();

//read all client data

ns.Close();
tc.Close();
}


In the client console, I wait in the loop with small sleeps for a long long while to wait if the server will send somthing, testing tcpClient.Connected property.
But it never becomes false???

Чесноков

AnswerRe: TcpClient does not get disconnected? Pin
N a v a n e e t h31-Oct-09 18:20
N a v a n e e t h31-Oct-09 18:20 
QuestionRe: TcpClient does not get disconnected? Pin
Chesnokov Yuriy31-Oct-09 19:59
professionalChesnokov Yuriy31-Oct-09 19:59 
AnswerRe: TcpClient does not get disconnected? Pin
N a v a n e e t h31-Oct-09 21:45
N a v a n e e t h31-Oct-09 21:45 
QuestionDrawing/Graphics in C#: Draw shapes like rectangle & triangle when respective radio button is checked. Pin
lexical131-Oct-09 7:47
lexical131-Oct-09 7:47 
AnswerRe: Drawing/Graphics in C#: Draw shapes like rectangle & triangle when respective radio button is checked. [modified] Pin
0x3c031-Oct-09 8:02
0x3c031-Oct-09 8:02 
GeneralRe: Drawing/Graphics in C#: Draw shapes like rectangle & triangle when respective radio button is checked. Pin
Richard MacCutchan31-Oct-09 10:47
mveRichard MacCutchan31-Oct-09 10:47 
GeneralRe: Drawing/Graphics in C#: Draw shapes like rectangle & triangle when respective radio button is checked. Pin
0x3c031-Oct-09 21:40
0x3c031-Oct-09 21:40 
GeneralRe: Drawing/Graphics in C#: Draw shapes like rectangle & triangle when respective radio button is checked. Pin
Richard MacCutchan31-Oct-09 21:53
mveRichard MacCutchan31-Oct-09 21:53 
AnswerRe: Drawing/Graphics in C#: Draw shapes like rectangle & triangle when respective radio button is checked. Pin
Luc Pattyn31-Oct-09 8:17
sitebuilderLuc Pattyn31-Oct-09 8:17 
GeneralRe: Drawing/Graphics in C#: Draw shapes like rectangle & triangle when respective radio button is checked. Pin
lexical131-Oct-09 19:37
lexical131-Oct-09 19:37 
GeneralRe: Drawing/Graphics in C#: Draw shapes like rectangle & triangle when respective radio button is checked. Pin
Luc Pattyn1-Nov-09 0:26
sitebuilderLuc Pattyn1-Nov-09 0:26 
Questionquestion Pin
anooshe31-Oct-09 7:45
anooshe31-Oct-09 7:45 
Answernot a Pin
Luc Pattyn31-Oct-09 8:14
sitebuilderLuc Pattyn31-Oct-09 8:14 
AnswerRe: question Pin
dan!sh 31-Oct-09 9:34
professional dan!sh 31-Oct-09 9:34 
AnswerRe: question Pin
Pete O'Hanlon31-Oct-09 9:54
mvePete O'Hanlon31-Oct-09 9:54 
AnswerRe: question Pin
Richard MacCutchan31-Oct-09 10:49
mveRichard MacCutchan31-Oct-09 10:49 
AnswerRe: question Pin
Christian Graus31-Oct-09 11:13
protectorChristian Graus31-Oct-09 11:13 

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.