---
name: "YCloseConnection"
section: "3"
platform: "linux"
package: "liby-dev"
version: "2.14.5-7"
release: "Debian 6.0 (Squeeze)"
platforms: ["linux"]
url: "https://new.carta.tech/YCloseConnection"
---

# YCloseConnection(3)

disconnects from Y server

## NAME

YCloseConnection - disconnects from Y server

## SYNTAX

\#include \<Y2/Y.h\>\
 \#include \<Y2/Ylib.h\>

void YCloseConnection(\
\
         YConnection \**connection*,\
\
         Boolean *no\_shutdown*\
 )

## ARGUMENTS

- *connection*

  Specifies the connection to the Y server, obtained by a call to YOpenConnection.

- *no\_shutdown*

  If True then the Y server will be left running. If False then if the original call to YOpenConnection which obtained the *connection* pointer started the Y server then the Y server will be shut down. However if the Y server was already running before the call to call to YOpenConnection then the Y server will not be shut down. The default and standard value is False.

## DESCRIPTION

The YCloseConnection function closes the connect to the Y server pointed to by *connection*. After calling this function, the given pointer *connection* should no longer be referanced.

You will not receive a YDisconnect event after calling this function, since the connection has been terminated and there is no way to receive further YEvents.

## EXAMPLE

\#include \<stdio.h\>\
 \#include \<Y2/Y.h\>\
 \#include \<Y2/Ylib.h\>

int main(int argc, char \*argv\[\])\
 {\
\
         YConnection \*con = YOpenConnection(\
\
                 "/usr/sbin/starty",\
\
                 "127.0.0.1:9433"\
\
         );\
\
         if(con == NULL)\
\
                 [return(1)](/return/1.md);

        YCloseConnection(con, False);

        return(0);\
 }

## SEE ALSO

[YOpenConnection(3)](/YOpenConnection/3.md) [YShutdownServer(3)](/YShutdownServer/3.md)
