Re: How to retrieve network socket?

Ramiro Morales <[email protected]>
Newsgroups gmane.comp.db.tds.freetds
Message-ID <CAO7PdF8NogzzWrd2Q5Wu4sT2NR=Kvbi2k1NALOqnVu79FrDeBg@mail.gmail.com>
On Wed, May 27, 2015 at 2:34 PM, John D. Robertson <[email protected]> wrote:
> On Wed, 27 May 2015 08:31:05 -0400
> "John D. Robertson" <[email protected]> wrote:
>
>> I can't seem to find how one goes about retrieving the network socket from DBPROCESS. For asynchronous queries, I'd like to submit the socket (among many other sockets) to select() to find out when there is data waiting to be read.
>>
>
>
> It looks like this works for a quick hack, but there should be an API call:
>
> DBPROCESS *dbp;
>
> /* Get connected to server ... */
>
> /* The first member of 'struct tds_dblib_dbprocess' is
>  * is a 'struct tds_socket*', and the first member of
>  * 'struct tds_socket' is the socket, an 'int' on all *nix systems.
>  */
>
> int sock= **((int**)dbp);
>
> /* There you go. */

DBIORDESC/DBIOWDESC/dbiordesc/dbiowdesc should be of help.

http://www.freetds.org/reference/a00341.html#ga74ac942f9b7baa49e1d7d18628321297

-- 
Ramiro Morales
@ramiromorales
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.