> zzppal...@gmail.com wrote:
> > I have a Socket Server and a client, but the server will not
[quoted text clipped - 20 lines]
> that case. I'm guessing that somewhere along the line, you set
> Form1.FSocket to null, causing the exception.
no where to set Form1.FSocket to null;
U can Assign a new Socket to it at constructor,and run the test
program,
first connects failed but the exception can be catched.
after 3 to 5minutes an UNHANDLED EXCEPTION will be thrown,and the
callstack will give u no useful message, only the Exception Window u
can extract exception message,
the exception throwed from another unnamed thread.
> Now, all that said: it's a bad idea to poll Socket.Connected at all.
> You should simply treat the connection normally unless there is an error
[quoted text clipped - 10 lines]
>
> Pete
It's a test program, and u can find this UNHANDLED EXCEPTION,
maybe it's a .netframework Socket bug.
Peter Duniho - 09 Aug 2007 06:09 GMT
> no where to set Form1.FSocket to null;
Well, something is getting set to null.
> U can Assign a new Socket to it at constructor,and run the test
> program,
Please stop abbreviating. If you can take the time to write anything,
you can take the time to write words correctly. Many people, myself
included, find it difficult to try to interpret "IM speak". You will
find the rate of response to your questions is proportional to the
quality of the text you write. If you can't be bothered to write in
plain language, other people won't bother to read what you wrote, never
mind try to help.
Now, that said. What test program? You haven't posted a test program.
> first connects failed but the exception can be catched.
> after 3 to 5minutes an UNHANDLED EXCEPTION will be thrown,and the
> callstack will give u no useful message, only the Exception Window u
> can extract exception message,
> the exception throwed from another unnamed thread.
I doubt that it's true that there is no null reference anywhere in the
call stack, given that the exception occurred. In fact,
NullReferenceExceptions are usually very easy to figure out, because all
you have to do is find the variable that's null and shouldn't be.
Still, if you post no code that anyone can test with, it is impossible
for anyone else to make an attempt to help you (other than explaining a
better way to write the code you did post, which I've already done).
> It's a test program, and u can find this UNHANDLED EXCEPTION,
> maybe it's a .netframework Socket bug.
It's not a .NET Framework Socket bug. What the bug is, I can't say.
You haven't bothered to post code that anyone could use to test to
explain to you what the problem is. But I'm sure this is a bug in your
own code, especially given the code you've already posted.
If you are unwilling to post a concise-but-complete example of code that
reliably reproduces the problem, then you should at least try making the
changes I suggested to see if that fixes your problem. The code you
posted is very wrong.
Pete