POP3c_Connect()

Establishes a TCP connection with the POP3 server.

Files

pop3-c.h/pop3-c.c

Prototype

NET_SOCK_ID  POP3c_Connect (NET_IPv4_ADDR   ip_server,
                            CPU_INT16U      port,
                            CPU_BOOLEAN     secure,
                            NET_ERR        *perr)


Arguments

ip_server

IP address of the POP3 server to contact.

port

TCP port to use. If ‘0’, pre-configured port is used.

secure

Desired value for client secure mode.

perr

Pointer to a variable that will hold the return error code from this function:

Returned Values

Connected socket ID, if no errors.

-1, otherwise.

Required Configuration

  • The network security manager MUST be available and enabled to open a secure POP3 connection (i.e: in “net_cfg.h”, NET_SECURE_CFG_EN should be DEF_ENABLED AND NET_CFG_TRANSPORT_LAYER_SEL should be configured for TCP). See µC/TCPIP user manual for more information about the network security manager.
  • A network security module MUST be included in the project (i.e: µC/SSL) to use the network security manager functionalities.

Notes / Warnings

  • If anything goes wrong while trying to connect to the server, the socket is closed by calling NetSock_Close(). Hence, all data structures are returned to their original state in case of a failure.
  • Before opening a secure POP3 connection, a certificate authority MUST be installed to validate the server identity.

Example Usage

See Sample Application.