Mobile Apps - Socket.Select() not working at win ce 6 r3

Asked By Igor Golikov
10-Nov-09 05:40 AM
Hi
I am trying to use Socket.Select() in my .net app on windows ce 6.
Sometimes it works and sometimes it throws NotSupported Exception ()
with following stack trace:

at System.Array.System.Collections.IList.RemoveAt(Int32 index)
at System.Net.Sockets.Socket.selectFD(IList SL, Int32[] fdarray)
at System.Net.Sockets.Socket.Select(IList checkRead, IList
checkWrite, IList checkError, Int32 microSeconds)

My checkRead list has 15 sockets, and checkWrite and checkError are
nulls.
I pass 1000 as a timeout and then I sleep my thread for 10ms before
another try...
If I watch in the debuger some sockets have available data (Availble =
xxx) but still exception is thrown.

Since this is NotSupported exception I may suppose that some operation
is not supported on win ce / .net compact?

Thanks
System.Array.System.Collections.IList.RemoveAt
(1)
System.Net.Sockets.Socket.selectFD
(1)
System.Net.Sockets.Socket.Select
(1)
Socket.Select
(1)
PaulThank
(1)
IList
(1)
MicroSeconds
(1)
CheckWrite
(1)
  Paul G. Tobey [eMVP] replied to Igor Golikov
11-Nov-09 12:05 AM
There are two things that come to mind: the framework itself is trying to do
something to an object that should not have that operation performed on it,
or you are performing an operation on an object that should not have that
operation performed on it.  Obviously, trying to identify what object is
being done to and what is being done to it is the basis of figuring  out what
to do about it, so you need to examine all of the exception information that
you get when it is thrown.  It would be worth checking whether there are any
cases where you attempt a Select() on a socket that is a) closed, b)
uninitialized, c) in some intermediate state where Select has no defined
behavior (like calling it on a socket before you bind it, try to connect it
to a server, etc.)

Paul T.
  Igor Golikov replied to Paul G. Tobey [eMVP]
11-Nov-09 02:17 AM
do
,
s
what
hat
any
it
=3D

Hi Paul
Thank you for your answer

Well I have done the same with Poll() and it works.
I just iterate through the list of same sockets Select() has failed on
and polling each of them for being readable. If the answer is yes, I
perform the receive operation on that socket.
It works for me.
I am sure that all the sockets are opened and connected.
I have tryed to look at the Select method in Reflektor but... to my
great surprise the function body is empty like in all Socket class
methods...
help