Click here to Skip to main content
15,921,548 members
Home / Discussions / .NET (Core and Framework)
   

.NET (Core and Framework)

 
AnswerRe: "........make sure u've not released resources before trying to use it"???? Pin
Gideon Engelberth20-Jul-09 3:25
Gideon Engelberth20-Jul-09 3:25 
GeneralRe: "........make sure u've not released resources before trying to use it"???? Pin
ChiSmile20-Jul-09 5:50
ChiSmile20-Jul-09 5:50 
GeneralRe: "........make sure u've not released resources before trying to use it"???? Pin
Gideon Engelberth20-Jul-09 12:00
Gideon Engelberth20-Jul-09 12:00 
QuestionRetrieve node texts from treenode Pin
vidhyaravichandar19-Jul-09 22:16
vidhyaravichandar19-Jul-09 22:16 
AnswerRe: Retrieve node texts from treenode Pin
Lee Humphries20-Jul-09 11:39
professionalLee Humphries20-Jul-09 11:39 
GeneralRe: Retrieve node texts from treenode Pin
vidhyaravichandar20-Jul-09 15:53
vidhyaravichandar20-Jul-09 15:53 
QuestionHow to include xml Pin
ksss_maheshece19-Jul-09 21:15
ksss_maheshece19-Jul-09 21:15 
QuestionAsync Sockets Pin
Lee Humphries19-Jul-09 20:38
professionalLee Humphries19-Jul-09 20:38 
I've just recently ported a sockets client from .Net 2.0 to .Net 3.5 ...
and now it runs into reoccurring problems, of which I'm a little suspicious may be related to subtle differences between the frameworks that I'm not allowing for.

Specifically the Receive Callback function is being invoked, but the socket itself is no longer connected (and probably disposed). This is in spite of the fact that data is expected to be received.

private void ReceiveCallback(IAsyncResult ar)
{
  SocketError sErr = SocketError.Success;
  int bytesRead = 0;
  lock (this)
  {
    try
    {
      // Retrieve the client socket from the asynchronous state object.
      Socket socket = (Socket)ar.AsyncState;

      sErr = new SocketError();

      // Read data from the remote device.
      // however this line frequently throws an exception
      bytesRead = socket.EndReceive(ar, out sErr);
      ...


And the essentials of the exception are:
ReceiveCallback threw an error. System.ObjectDisposedException: Cannot access a disposed object.
Object name: 'System.Net.Sockets.Socket'.
   at System.Net.Sockets.Socket.EndReceive(IAsyncResult asyncResult, SocketError& errorCode)


The associated socket error code is 10038 - which when you read its description isn't very helpful either.

Just to add to this the previous version of this client is still running and still connecting to the same server without issue.

My request is if anyone can point me in the right direction as to what I'm missing or doing wrong. You can reasonably assume that I've googled every permutation of the above in my quest.

Here's some possibilities:
* There's some subtle distinction in how v2.0 and v3.5 sockets connect (e.g. defaults for various socket options) that the server I'm connecting doesn't like / understand.
* It's a speed issue. The v2.0 code has got a whole heap of throttling tricks, that the v3.5 based version does not - I don't think this one's likely (already been playing around in this area).
* It's a threading and/or locks problem on the socket itself.
* I'm missing something important in using sockets - not likely, but this excuse is here for completeness, just in case you have some "traps for young players" type of insight.
* Or something else.

I just love Koalas - they go great with Bacon.

AnswerRe: Async Sockets Pin
Nicholas Butler19-Jul-09 22:13
sitebuilderNicholas Butler19-Jul-09 22:13 
GeneralRe: Async Sockets Pin
Lee Humphries20-Jul-09 11:34
professionalLee Humphries20-Jul-09 11:34 
GeneralRe: Async Sockets - the answer Pin
Lee Humphries20-Jul-09 19:11
professionalLee Humphries20-Jul-09 19:11 
Questiontest Pin
chandni patel18-Jul-09 23:35
chandni patel18-Jul-09 23:35 
AnswerRe: test Pin
Abhijit Jana19-Jul-09 0:14
professionalAbhijit Jana19-Jul-09 0:14 
AnswerResult Pin
leckey19-Jul-09 18:42
leckey19-Jul-09 18:42 
AnswerRe: test Pin
0x3c019-Jul-09 20:45
0x3c019-Jul-09 20:45 
QuestionCombobox - DrawItem and dragging scroll bar problem Pin
David Hovey18-Jul-09 19:18
David Hovey18-Jul-09 19:18 
AnswerRe: Combobox - DrawItem and dragging scroll bar problem Pin
Luc Pattyn19-Jul-09 2:43
sitebuilderLuc Pattyn19-Jul-09 2:43 
GeneralRe: Combobox - DrawItem and dragging scroll bar problem Pin
David Hovey19-Jul-09 6:50
David Hovey19-Jul-09 6:50 
GeneralRe: Combobox - DrawItem and dragging scroll bar problem Pin
Luc Pattyn19-Jul-09 8:26
sitebuilderLuc Pattyn19-Jul-09 8:26 
GeneralRe: Combobox - DrawItem and dragging scroll bar problem [modified] Pin
David Hovey19-Jul-09 11:51
David Hovey19-Jul-09 11:51 
GeneralRe: Combobox - DrawItem and dragging scroll bar problem Pin
Luc Pattyn19-Jul-09 12:17
sitebuilderLuc Pattyn19-Jul-09 12:17 
GeneralRe: Combobox - DrawItem and dragging scroll bar problem Pin
David Hovey19-Jul-09 12:33
David Hovey19-Jul-09 12:33 
Questionloading text [modified] Pin
deadcell_618-Jul-09 8:50
deadcell_618-Jul-09 8:50 
AnswerRe: loading text Pin
Luc Pattyn18-Jul-09 9:07
sitebuilderLuc Pattyn18-Jul-09 9:07 
GeneralRe: loading text [modified] Pin
deadcell_618-Jul-09 9:11
deadcell_618-Jul-09 9:11 

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.