connectToServer establishes a connection to the server.
(ctx context.Context)
| 1991 | |
| 1992 | // connectToServer establishes a connection to the server. |
| 1993 | func (c *Client) connectToServer(ctx context.Context) error { |
| 1994 | if c.useStdio { |
| 1995 | // Already connected via stdio in startCLIServer |
| 1996 | return nil |
| 1997 | } |
| 1998 | |
| 1999 | // Connect via TCP |
| 2000 | return c.connectViaTCP(ctx) |
| 2001 | } |
| 2002 | |
| 2003 | // connectViaTCP connects to the CLI server via TCP socket. |
| 2004 | func (c *Client) connectViaTCP(ctx context.Context) error { |