470,818 Members | 1,604 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 470,818 developers. It's quick & easy.

Socket.Select butI have only Int32 socket-descriptors...

I have an unmanaged library that handle many TCP/IP connections.
In my .NET application i want to test if there is input available
on these connections.
Using an existing function of the unmanaged library I'm able to retrieve
the list of Int32 socket-descriptors handled by the unmanaged library.
How can I use this list of Int32 socket-descriptors inside my C# program
to test if there is input available on these socket-descriptors?

I want to use the Socket.Select method of .NET
but this method wants a list of Socket
and I have only a list of Int32.

There is some manner to transform an Int32 socket-descriptor
into a Socket so I will be able to use Socket.Select?

Thanks for the help

-- Dario

Jul 21 '05 #1
7 2324
Dario wrote:
I have an unmanaged library that handle many TCP/IP connections.
In my .NET application i want to test if there is input available
on these connections.
Using an existing function of the unmanaged library I'm able to retrieve
the list of Int32 socket-descriptors handled by the unmanaged library.
How can I use this list of Int32 socket-descriptors inside my C# program
to test if there is input available on these socket-descriptors?

I want to use the Socket.Select method of .NET
but this method wants a list of Socket
and I have only a list of Int32.

There is some manner to transform an Int32 socket-descriptor
into a Socket so I will be able to use Socket.Select?

Thanks for the help

-- Dario


Any suggestion?

Jul 21 '05 #2
Dario wrote:
I have an unmanaged library that handle many TCP/IP connections.
In my .NET application i want to test if there is input available
on these connections.
Using an existing function of the unmanaged library I'm able to retrieve
the list of Int32 socket-descriptors handled by the unmanaged library.
How can I use this list of Int32 socket-descriptors inside my C# program
to test if there is input available on these socket-descriptors?

I want to use the Socket.Select method of .NET
but this method wants a list of Socket
and I have only a list of Int32.

There is some manner to transform an Int32 socket-descriptor
into a Socket so I will be able to use Socket.Select?

Thanks for the help

-- Dario


Any suggestion?

Jul 21 '05 #3

"Dario" <da***@despammed.com> wrote in message
news:bm**********@fata.cs.interbusiness.it...
I have an unmanaged library that handle many TCP/IP connections.
In my .NET application i want to test if there is input available
on these connections.
Using an existing function of the unmanaged library I'm able to retrieve
the list of Int32 socket-descriptors handled by the unmanaged library.
How can I use this list of Int32 socket-descriptors inside my C# program
to test if there is input available on these socket-descriptors?

I want to use the Socket.Select method of .NET
but this method wants a list of Socket
and I have only a list of Int32.

There is some manner to transform an Int32 socket-descriptor
into a Socket so I will be able to use Socket.Select?
I'm afraid there is no way I am aware of...it is likely not possible.
However, you could probably write a small piece of Managed C++ that performs
the select operation for you while exposing a nicer interface than PInvoke.
That unfortunatly is the only path I see(and that is basically all
Socket.Select does, wraps arround the native select call).

However, if anyone from MS is reading this, exposing support directly for
socket descriptors is of some use in interop situations!
Thanks for the help

-- Dario

Jul 21 '05 #4

"Dario" <da***@despammed.com> wrote in message
news:bm**********@fata.cs.interbusiness.it...
I have an unmanaged library that handle many TCP/IP connections.
In my .NET application i want to test if there is input available
on these connections.
Using an existing function of the unmanaged library I'm able to retrieve
the list of Int32 socket-descriptors handled by the unmanaged library.
How can I use this list of Int32 socket-descriptors inside my C# program
to test if there is input available on these socket-descriptors?

I want to use the Socket.Select method of .NET
but this method wants a list of Socket
and I have only a list of Int32.

There is some manner to transform an Int32 socket-descriptor
into a Socket so I will be able to use Socket.Select?
I'm afraid there is no way I am aware of...it is likely not possible.
However, you could probably write a small piece of Managed C++ that performs
the select operation for you while exposing a nicer interface than PInvoke.
That unfortunatly is the only path I see(and that is basically all
Socket.Select does, wraps arround the native select call).

However, if anyone from MS is reading this, exposing support directly for
socket descriptors is of some use in interop situations!
Thanks for the help

-- Dario

Jul 21 '05 #5
"Daniel O'Connell" <onyxkirx@--NOSPAM--comcast.net> wrote in
news:Ufsib.553677$cF.233183@rwcrnsc53:
However, if anyone from MS is reading this, exposing support directly
for socket descriptors is of some use in interop situations!


Yes, but if you're doing interop, then you can do the interop to check the
socket descriptors directly.

We definately don't need the framework classes cluttered up with interop
calls for every imaginable situation (not to mention that that makes the
classes unportable!)

Mark
Jul 21 '05 #6

"Mark" <mark@--somewhere--.com> wrote in message
news:Xn******************************@207.46.248.1 6...
"Daniel O'Connell" <onyxkirx@--NOSPAM--comcast.net> wrote in
news:Ufsib.553677$cF.233183@rwcrnsc53:
However, if anyone from MS is reading this, exposing support directly
for socket descriptors is of some use in interop situations!

Yes, but if you're doing interop, then you can do the interop to check the
socket descriptors directly.

We definately don't need the framework classes cluttered up with interop
calls for every imaginable situation (not to mention that that makes the
classes unportable!)


Not nessecerly, Every socket runtime I know of uses a descriptor for
sockets, thats pretty standard. What the descriptor contains is irrelevent.
Beyond that, the feature certainly doesn't have to exist IN the socket
class, I just hate re-writing functionality that the framework already does,
quite literally, because they didn't expose the proper method.
If you look at the Socket.Select method, it converts the list of Sockets
into descriptors and passes them to the native select(the berkely one it
seems, not WSASelect). Now because there is no way to access that directly,
You are going to end up writing pretty close to identical code just because
they take sockets and convert them. Its a minor annoyance. However it
doesn't break portability any more than SetSocketOpt does.
It is far less annoying than the screwed up file naming rules for creating
file streams, but annoying none the less.

Mark

Jul 21 '05 #7
Check out Socket.Select static method. It is in .NET 1.0, 1.1 and 2.0. It should do the job
Jul 30 '06 #8

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

4 posts views Thread by DreJoh | last post: by
8 posts views Thread by Grant Richard | last post: by
2 posts views Thread by zhebincong | last post: by
reply views Thread by Vladimir Lushnikov | last post: by
reply views Thread by Macca | last post: by
11 posts views Thread by hazz | last post: by
1 post views Thread by Mr. Beck | last post: by
reply views Thread by mihailmihai484 | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.