Hi,

I am attempting to convert some C code into something that I could use
in C#. Currently what I have done is in VC++ 6.0 created a DLL that is a
wrapper for a .lib file so that I can reference it via C# (if it makes
any difference it is Bloomberg's bbapi.lib file).

Anyway, in order to read data from bloomberg, you are given the
following code in a "response_loop"

// SOCKET is defined as an int
SOCKET bb_sock;
// connection is a void * type. Both are being used in .Net as IntPtr
bb_sock = bb_getsocket( connection );

// This is the part of the code that I need to get working in C#.
fd_set read_set, exec_set;

FD_ZERO( &read_set );
FD_ZERO( &exec_set );
FD_SET( (int) bb_sock, &read_set );
FD_SET( (int) bb_sock, &exec_set );
// timeout is set to 1 sec and 0 usec
select( bb_sock + 1, &read_set, NULL, &exec_set, &timeout );

I suspect I can use Socket.Select, which is fine, but what I can't
figure out is how to convert the int SOCKET into a Socket object or the
connection void * into some type of connection object. Not sure if the
latter is possible because I'm not sure what type of object it is, but
the SOCKET object is probably a Socket, yes?

Any thoughts on how I could do this? I thought there would be some easy
way to get a Socket from the OS Handle. I know I can do a sock.Handle
and get the Handle, but I can't see how to create a Socket based on a
Handle (this is of course assuming that it is a Handle that I have).

Thanks in advance for any help/hints,
-akshay

===================================
This list is hosted by DevelopMentor�  http://www.develop.com
NEW! ASP.NET courses you may be interested in:

2 Days of ASP.NET, 29 Sept 2003, in Redmond
http://www.develop.com/courses/2daspdotnet

Guerrilla ASP.NET, 13 Oct 2003, in Boston
http://www.develop.com/courses/gaspdotnet

View archives and manage your subscription(s) at http://discuss.develop.com

Reply via email to