connect Function

Microchip TCP/IP Stack

Microchip TCP/IP Stack Help
connect Function
C
int connect(
    SOCKET s, 
    struct sockaddr* name, 
    int namelen
);
Description

The connect function assigns the address of the peer communications endpoint. For stream sockets, connection is established between the endpoints. For datagram sockets, an address filter is established between the endpoints until changed with another connect() function.

Preconditions

socket function should be called.

Parameters
Parameters 
Description 
Socket descriptor returned from a previous call to socket. 
name 
pointer to the sockaddr structure containing the peer address and port number. 
namelen 
length of the sockaddr structure. 
Returns

If the connect() function succeeds, it returns 0. Otherwise, the value SOCKET_ERROR is returned to indicate an error condition. For stream based socket, if the connection is not established yet, connect returns SOCKET_CNXN_IN_PROGRESS.

Remarks

None.

Microchip TCP/IP Stack 5.42.08 - June 15, 2013
Copyright © 2012 Microchip Technology, Inc.  All rights reserved.