---
name: "new_PConnection"
section: "3"
platform: "linux"
package: "coldsync"
version: "3.0+pre3-3"
release: "Debian 4.0 (Etch)"
platforms: ["linux"]
url: "https://new.carta.tech/new_PConnection"
---

# new\_PConnection(3)

create a new connection to a PalmOS device

## NAME

**new\_PConnection** – create a new connection to a PalmOS device

## LIBRARY

*libpconn*

## SYNOPSIS

**#include \<palm.h\>**

**#include \<pconn/pconn.h\>**

*PConnection* *\**\

**new\_PConnection**(*char \*device*, *const pconn\_listen\_t listenType*, *const pconn\_proto\_t protocol*, *const unsigned short flags*);

## DESCRIPTION

**new\_PConnection** creates and initializes a new *PConnection*. This represents a connection to a Palm device, similar to a socket or a telephone. **new\_PConnection** does not connect to the Palm, it merely creates an object that can connect later (in the telephone analogy, it builds the phone but doesn't dial it). The *PConnection* should be closed and destroyed with **PConnClose**().

*device* specifies the pathname of the Palm device, *e.g.* */dev/cuaa0* for a serial port. If *device* is NULL or the special string 'stdin',  **new\_PConnection** uses standard input and standard output.

*listenType* specifies the underlying connection to the Palm cradle. It is one of:

- LISTEN\_SERIAL

  Serial connection, including USB connections through */dev/ttyUSB1* under Linux.

- LISTEN\_NET

  TCP connection. The *device* argument is ignored.

- LISTEN\_USB

  USB connection under \*BSD. *device* should be “/dev/ugen0”.

*protocol* specifies the software protocol to use to communicate with the Palm cradle. This should be one of:

- PCONN\_STACK\_DEFAULT

  Guess at the correct protocol. This will usually be correct, but not always.

- PCONN\_STACK\_FULL

  Use the DLP, PADP, and SLP protocols. This is the default for LISTEN\_SERIAL and LISTEN\_USB.

- PCONN\_STACK\_SIMPLE

  Use the DLP protocol and a variant of the NetSync protocol. This is currently only used by Palm m500s and m505s.

- PCONN\_STACK\_NET

  Use the DLP and NetSync protocols. This is the default for LISTEN\_NET.

*flags* is the bitwise-or of PCONNFL\_TRANSIENT , PCONNFL\_PROMPT. and PCONNFL\_NOCHANGESPEED. If PCONN\_TRANSIENT has been specified, the device may or may not exist at any given time, so that if open() fails to open the device because the file does not exist (ENOENT), this is not an error. This is useful in conjunction with devfs.

If PCONN\_PROMPT has been specified, **new\_PConnection** will prompt the user to press the HotSync button on the cradle, after the device has been opened.

If PCONN\_NOCHANGESPEED has been specified, **new\_PConnection** will not attept to change the change the speed of the connection that specified by the palm, which breaks modem connections.

## RETURN VALUE

**new\_PConnection** returns a pointer to a new *PConnection*, or NULL in case of error.

## SEE ALSO

[libpconn(3)](/libpconn/3.md), PConnClose(3,) PConn\_bind.
