Selecting between yarp socket and classic vanilla socket

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

Selecting between yarp socket and classic vanilla socket

Pol Monsó IRI
Hello!

I'm starting with yarp, and I wonder how could I obtain the file descriptor of the yarp connection between client and my device? The scenario is that I have a yarp client that would input commands (strings) on another thread (let's call is 'A') which will forward them to another plain socket. 'A' should select both yarp connection and the other socket connection for input. The secondary socket is not on yarp so I plan to use the 'select' function but I need the file descriptor number for the yarp socket, is there an easy way to retrieve it?

Thanks a lot!

Pol Monsó

------------------------------------------------------------------------------
Open Source Business Conference (OSBC), March 24-25, 2009, San Francisco, CA
-OSBC tackles the biggest issue in open source: Open Sourcing the Enterprise
-Strategies to boost innovation and cut costs with open source participation
-Receive a $600 discount off the registration fee with the source code: SFAD
http://p.sf.net/sfu/XcvMzF8H
_______________________________________________
Robotcub-hackers mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/robotcub-hackers
Reply | Threaded
Open this post in threaded view
|

Re: Selecting between yarp socket and classic vanilla socket

Pol Monsó IRI
Sorry to bump again, I'm stuck on trying to work out a "select" for yarp. I'll build up a bridge yarp/plain socket but it would be much more practical to get the file descriptor for the yarp connection right away or any other suggestion on how to listen to a plain socket while listening to yarp would be highly appreciated.

Thank you very much,

Pol Monsó

2009/3/3 Pol Monsó IRI <[hidden email]>
Hello!

I'm starting with yarp, and I wonder how could I obtain the file descriptor of the yarp connection between client and my device? The scenario is that I have a yarp client that would input commands (strings) on another thread (let's call is 'A') which will forward them to another plain socket. 'A' should select both yarp connection and the other socket connection for input. The secondary socket is not on yarp so I plan to use the 'select' function but I need the file descriptor number for the yarp socket, is there an easy way to retrieve it?

Thanks a lot!

Pol Monsó


------------------------------------------------------------------------------

_______________________________________________
Robotcub-hackers mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/robotcub-hackers
Reply | Threaded
Open this post in threaded view
|

Re: Selecting between yarp socket and classic vanilla socket

paulfitz
Administrator
Pol Monsó IRI wrote:
> Sorry to bump again, I'm stuck on trying to work out a "select" for
> yarp. I'll build up a bridge yarp/plain socket but it would be much
> more practical to get the file descriptor for the yarp connection
> right away or any other suggestion on how to listen to a plain socket
> while listening to yarp would be highly appreciated.

Hi Pol,

YARP won't give you file descriptors unless you do some hacking.  
Connections can be lots of different types, not just tcp sockets, and
YARP was built to avoid code depending on connections being of any
special type.

To hack what you want, you'd need to add a method to SocketTwoWayStream
to report the fd, then get Protocol to pass that on to ports via
PortCoreUnit.

A cleaner option would be add an extra carrier (specializing TcpCarrier)
to handle whatever the protocol is on the non-YARP sockets.  See:
  http://eris.liralab.it/yarpdoc/carrier_expert.html

But it feels like you're maybe making life hard on yourself.  Perhaps
you could describe the overall goal you're trying to achieve, as opposed
to the way you want to do it, and we can find a better way to fit YARP
into your plans?

Sorry not to be of much help.

Paul

> 2009/3/3 Pol Monsó IRI <[hidden email] <mailto:[hidden email]>>
>
>     Hello!
>
>     I'm starting with yarp, and I wonder how could I obtain the file
>     descriptor of the yarp connection between client and my device?
>     The scenario is that I have a yarp client that would input
>     commands (strings) on another thread (let's call is 'A') which
>     will forward them to another plain socket. 'A' should select both
>     yarp connection and the other socket connection for input. The
>     secondary socket is not on yarp so I plan to use the 'select'
>     function but I need the file descriptor number for the yarp
>     socket, is there an easy way to retrieve it?
>
>     Thanks a lot!
>
>     Pol Monsó
>
>
> ------------------------------------------------------------------------
>
> ------------------------------------------------------------------------------
>  
> ------------------------------------------------------------------------
>
> _______________________________________________
> Robotcub-hackers mailing list
> [hidden email]
> https://lists.sourceforge.net/lists/listinfo/robotcub-hackers
>  


------------------------------------------------------------------------------
_______________________________________________
Robotcub-hackers mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/robotcub-hackers