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

C#

 
GeneralRe: Drawing/Graphics in C#: Drawing/Graphics in C#, if the mouse is right clicked over square,turn square into a diamond. Pin
lexical11-Nov-09 0:04
lexical11-Nov-09 0:04 
Questionread barcode using usb scanner Pin
vivekmalik005731-Oct-09 19:14
vivekmalik005731-Oct-09 19:14 
AnswerRe: read barcode using usb scanner Pin
Abhishek Sur31-Oct-09 21:55
professionalAbhishek Sur31-Oct-09 21:55 
QuestionRunning a command on remote pc Pin
CodingYoshi31-Oct-09 15:32
CodingYoshi31-Oct-09 15:32 
AnswerRe: Running a command on remote pc Pin
Wes Aday31-Oct-09 18:11
professionalWes Aday31-Oct-09 18:11 
QuestionVoice streaming using C# Pin
tobibabs31-Oct-09 13:52
tobibabs31-Oct-09 13:52 
AnswerRe: Voice streaming using C# Pin
Mycroft Holmes31-Oct-09 22:00
professionalMycroft Holmes31-Oct-09 22:00 
QuestionAsync TcpListener recieves ClientAccept after stoping listening. How to notify it that the client disconnected? Pin
Chesnokov Yuriy31-Oct-09 10:49
professionalChesnokov Yuriy31-Oct-09 10:49 
I've got 1 accepted connection from TcpClient in async TcpListener.

I read all data from the client and then close its connection. But it might not be closed as described in the previous post.

After I invoke Stop() in TcpListener it recieves async client connect message. Then in that handler the System.ObjectDisposedException in System.Net.Sockets.Socket EndAccept(System.IAsyncResult) happens with message access to destroyed object is prohibited. object name "System.Net.Sockets.Socket"

What is the reason for that?

private void TcpListenerClientConnectAsyncCallback(IAsyncResult ar)
{
TcpListener tcpListener = (TcpListener)ar.AsyncState;
TcpClient tcpClient = this.tcpListener.EndAcceptTcpClient(ar);
NetworkStream ns = tcpClient.GetStream();
ns.BeginRead(buffer, 0, 1024, new AsyncCallback(TcpListenerDataReadAsyncCallback), tcpClient);
tcpListener.BeginAcceptTcpClient(new AsyncCallback(TcpListenerClientConnectAsyncCallback), tcpListener);
}


Also is there a way to notify the TcpListener that the TcpClient disconnected from its side? as in C++ winsock using windows messages FD_ACCEPT, FD_READ, ... ?


Чесноков

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 
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 

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.