KwikNet TCP/IP Sockets
K
DAK
197
kn_connect kn_connect
Purpose Connect a Socket to a Specific Address
Used by
n Task o ISP o Timer Procedure o Restart Procedure o Exit Procedure
Setup Prototype is in file KN_SOCK.H.
#include "KN_SOCK.H"
int kn_connect(int s, struct sockaddr *destaddr, int addrlen);
Description S is a socket descriptor identifying the socket to which the specified
address is to be bound.
Destaddr is a pointer to a structure containing the specific address to
which the socket must be bound. The format of the IP address in
structure sockaddr is described in header file KN_SOCK.H.
Addrlen is the length of the address at *destaddr, measured in bytes.
If socket s is of type SOCK_STREAM, then an attempt will be made to
establish a connection with the address specified in the call. Stream
sockets may successfully connect only once.
If socket s is of type SOCK_DGRAM, then *destaddr specifies the
address of the peer with which the socket is to be associated. This is
the address to which datagrams are to be sent and is the only address
from which datagrams are to be received. For datagram sockets, you
can call kn_connect() at any time to change the connection address.
To disconnect a datagram socket, call kn_connect() passing it a null
(all zeroes) address in *destaddr.
Returns If successful, a value of 0 is returned.
On failure, the error status
-1 is returned.
...more
Comments to this Manuals