SetSocketOption fails for SocketOptionName

N

Nathan Kerr

I have been working with KB Article 812404 "HOW TO: Write
Pluggable Protocol to Supprot FTP in Managed Classes by
Using Visual Bassic.NET".

I have modified the code to run on a Pocket PC. In the
OpenControlConnection routine the following lines are
being executed:

m_DataSocket.SetSocketOption
(SocketOptionLevel.Socket, SocketOptionName.SendTimeout,
m_ConnectTimeout)
m_DataSocket.SetSocketOption
(SocketOptionLevel.Socket,
SocketOptionName.ReceiveTimeout, m_DataReceiveTimeout)

The SendTimeout one works. The ReceiveTimeout fails with:
---------------------------------------------------------
An unhandled exception of
type 'System.Net.Sockets.SocketException' occurred in
System.dll

Additional information: An unknown, invalid, or
unsupported option or level was specified in a getsockopt
or setsockopt call
----------------------------------------------------------

I assume this works with regular projects. The
documentation says that ReceiveTimeout is supported by the
compact framework.

Am I running into a bug in the compact framework?
 
A

Alex Feinman [MVP]

You are running into a bug in the documentation, or rather a case of
misleading documentation. Compact Framework supports this option in a sense
that the option is recognized. However Windows CE does not support this
option - what you are seeing is an OS error.

In general, when it says "Supported by compact framework" in the
documentation, it means that there is not going to be a compile error. Of
course Window CE being a modular OS (think smartphone), might not implement
certain feature.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top