Archiv für Mai 2008

Exception after sending data async from a thread

Samstag, 24. Mai 2008

If you have a situation like this:

void MyThreadFunc()
{
// do some work

socket.BeginSend(buffer, 0, buffer.Length, 0, new AsyncCallback(MyCallback), s);
}

void MyCallback(IAsyncResult ar)
{
Socket s = (Socket) ar.AsyncState;
s.EndSend(ar);
}

And you send a big buffer over a slow connection it can happen that calling EndSend() will throw a SocketException ‘The I/O operation has been aborted because of either a thread exit or an application request’.

This happens because the Thread that started the sending is no more available when the sending ends. The only solution I know is to make sure the thread is still available or to use syncronous sending if possible.

Schon wieder neuer Highscore

Dienstag, 13. Mai 2008

Der letzte Highscore hatte nicht so lange Bestand wie der vorherige. Gleich mehrere Einträge (desselben Spammers) entthronten den Spitzenreiter, aber der der neue Spitzenwert ist wirklich Spitze (da wird das Karma schon in der Exponential-Schreibweise angegeben).

Neue Spam Highscores, -1378353.73 (-1.37835e+06)

Die Exponential-Schreibweise lässt noch einigen Spielraum… ;-)