libssh2\_channel\_open\_ex(3) libssh2 libssh2\_channel\_open\_ex(3)

# [NAME](#NAME)

libssh2\_channel\_open\_ex - establish a generic session channel

# [SYNOPSIS](#SYNOPSIS)

```
#include <libssh2.h>
LIBSSH2_CHANNEL *
libssh2_channel_open_ex(LIBSSH2_SESSION *session, const char *channel_type,


                        unsigned int channel_type_len,


                        unsigned int window_size,


                        unsigned int packet_size,


                        const char *message, unsigned int message_len);
LIBSSH2_CHANNEL *
libssh2_channel_open_session(session);
```

# [DESCRIPTION](#DESCRIPTION)

*session* - Session instance as returned by [**libssh2\_session\_init\_ex(3)**](/man/os/libssh2/libssh2_session_init_ex.3)

*channel\_type* - Channel type to open. Typically one of session, direct-tcpip, or tcpip-forward. The SSH2 protocol allowed for additional types including local, custom channel types.

*channel\_type\_len* - Length of channel\_type

*window\_size* - Maximum amount of unacknowledged data remote host is allowed to send before receiving an SSH\_MSG\_CHANNEL\_WINDOW\_ADJUST packet.

*packet\_size* - Maximum number of bytes remote host is allowed to send in a single SSH\_MSG\_CHANNEL\_DATA or SSG\_MSG\_CHANNEL\_EXTENDED\_DATA packet.

*message* - Additional data as required by the selected channel\_type.

*message\_len* - Length of message parameter.

Allocate a new channel for exchanging data with the server. This method is typically called through its macroized form: [**libssh2\_channel\_open\_session(3)**](/man/os/libssh2/libssh2_channel_open_session.3) or via [**libssh2\_channel\_direct\_tcpip(3)**](/man/os/libssh2/libssh2_channel_direct_tcpip.3) or [**libssh2\_channel\_forward\_listen(3)**](/man/os/libssh2/libssh2_channel_forward_listen.3)

# [RETURN VALUE](#RETURN_VALUE)

Pointer to a newly allocated LIBSSH2\_CHANNEL instance, or NULL on errors.

# [ERRORS](#ERRORS)

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

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

*LIBSSH2\_ERROR\_CHANNEL\_FAILURE* -

*LIBSSH2\_ERROR\_EAGAIN* - Marked for non-blocking I/O but the call would block.

# [SEE ALSO](#SEE_ALSO)

Add related functions

1 Jun 2007 libssh2 0.15

---

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