libssh2\_channel\_x11\_req\_ex(3) libssh2 libssh2\_channel\_x11\_req\_ex(3)

# [NAME](#NAME)

libssh2\_channel\_x11\_req\_ex - request an X11 forwarding channel

# [SYNOPSIS](#SYNOPSIS)

```
#include <libssh2.h>
int
libssh2_channel_x11_req_ex(LIBSSH2_CHANNEL *channel, int single_connection,


                           const char *auth_proto, const char *auth_cookie,


                           int screen_number);
int
libssh2_channel_x11_req(LIBSSH2_CHANNEL *channel,


                        int screen_number);
```

# [DESCRIPTION](#DESCRIPTION)

*channel* - Previously opened channel instance such as returned by [**libssh2\_channel\_open\_ex(3)**](/man/os/libssh2/libssh2_channel_open_ex.3)

*single\_connection* - non-zero to only forward a single connection.

*auth\_proto* - X11 authentication protocol to use

*auth\_cookie* - the cookie (hexadecimal encoded).

*screen\_number* - the XLL screen to forward

Request an X11 forwarding on *channel*. To use X11 forwarding, [**libssh2\_session\_callback\_set2(3)**](/man/os/libssh2/libssh2_session_callback_set2.3) must first be called to set **LIBSSH2\_CALLBACK\_X11**. This callback will be invoked when the remote host accepts the X11 forwarding.

# [RETURN VALUE](#RETURN_VALUE)

Return 0 on success or negative on failure. It returns LIBSSH2\_ERROR\_EAGAIN when it would otherwise block. While LIBSSH2\_ERROR\_EAGAIN is a negative number, it is not really a failure per se.

# [ERRORS](#ERRORS)

*LIBSSH2\_ERROR\_ALLOC* - An internal memory allocation call failed.

*LIBSSH2\_ERROR\_SOCKET\_SEND* - Unable to send data on socket.

*LIBSSH2\_ERROR\_CHANNEL\_REQUEST\_DENIED* -

# [SEE ALSO](#SEE_ALSO)

[**libssh2\_channel\_open\_ex(3)**](/man/os/libssh2/libssh2_channel_open_ex.3) [**libssh2\_session\_callback\_set2(3)**](/man/os/libssh2/libssh2_session_callback_set2.3)

1 Jun 2007 libssh2 0.15

---

Document: libssh2_channel_x11_req_ex(3) from libssh2 1.11.1-r11 (Chainguard OS)
Source: https://github.com/libssh2/libssh2.git
