0
0to60
I have a class that wraps a TcpClient object and manages all the async
reading of the socket. It works really nice, and I use it all over the
place. But there's this ONE INSTANCE where I create one of these things and
it WON'T read data. If I set a breakpoint in my EndRead callback, it never
goes off. NOTHING is different from anywhere else I use this class, its
just this one place.
Now, if I create a second constructor for my class that DOESN'T start off
the async reading process (basically, never calls BeginRead()), subsequent
Read()s will receive data. Additionally, if I do a loop like this:
while(!networkStream.DataAvailable)
Sleep(250);
networkStream.BeginRead(...)
Then the class works like it does everywhere else. Its like, in this one
instance (and this instance isn't any different than anywhere else I use
this class), I can't just do a BeginRead() and wait for data to come in. I
have to loop and check DataAvailable before calling BeginRead().
Any suggestions?
reading of the socket. It works really nice, and I use it all over the
place. But there's this ONE INSTANCE where I create one of these things and
it WON'T read data. If I set a breakpoint in my EndRead callback, it never
goes off. NOTHING is different from anywhere else I use this class, its
just this one place.
Now, if I create a second constructor for my class that DOESN'T start off
the async reading process (basically, never calls BeginRead()), subsequent
Read()s will receive data. Additionally, if I do a loop like this:
while(!networkStream.DataAvailable)
Sleep(250);
networkStream.BeginRead(...)
Then the class works like it does everywhere else. Its like, in this one
instance (and this instance isn't any different than anywhere else I use
this class), I can't just do a BeginRead() and wait for data to come in. I
have to loop and check DataAvailable before calling BeginRead().
Any suggestions?