473,408 Members | 2,450 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,408 software developers and data experts.

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 2436
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
by: DreJoh | last post by:
I've read many articles on the subject and the majority of them give the same solution that's in article 821625 on the MSDN website. I'm using the following code and when a the client disconnects...
8
by: Grant Richard | last post by:
Using the TcpListener and TcpClient I created a program that just sends and receives a short string - over and over again. The program is fine until it gets to around 1500 to 1800 messages. At...
4
by: zbcong | last post by:
Hello: I write a multithread c# socket server,it is a winform application,there is a richtextbox control and button,when the button is click,the server begin to listen the socket port,waiting for a...
2
by: zhebincong | last post by:
Hello: I write a multithread c# socket server,it is a winform application,there is a richtextbox control and button,when the button is click,the server begin to listen the socket port,waiting...
0
by: Vladimir Lushnikov | last post by:
Hi, I'm experimenting with the Seqpacket protocol, because the connectionless protocols aren't enough for my needs, and TCP/IP doesn't preserve message boundaries. This is what I've currently...
0
by: Macca | last post by:
Hi, I am writing an asychronous socket server to handle 20+ simulataneous connections. I have used the example in MSDN as a base. The code is shown at end of question. Each connection has a...
11
by: hazz | last post by:
smtpClient.Send(message) is causing me problems as per specifics in the trace below. Email is sent but not without this error typically upon sending the second email, but sometimes when running...
4
by: Kevin | last post by:
I got the following error when revieving data from a server. hostSystem.Net.Sockets.SocketException: An existing connection was forcibly closed by the remote host at...
1
by: Mr. Beck | last post by:
Hello, Please Help..... I have been working with some tcp/ip socket communication within a C# program recently. Basicly, I have a program (myProblemProgram) that has a socket connected to...
5
by: Arno | last post by:
reposted with the right microsoft managed newsgroup ID: Sorry for the inconvinience Hi, I've written a class for client-socket connection, but I get a lot of times the error message "Unable...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.