CrossCore XA
Revision: 1.0
Programmers Guide
Date: Jul 1, 10
ret = select((sc > sa)?sc+1:sa+1, &readfds, NULL, NULL, NULL);
if
(FD_ISSET(sc, &readfds)) {
ret = recvfrom(sc, &msg,
sizeof
(msg), 0,
(
struct
sockaddr*)&caddr, &caddrlen);
}
if
(FD_ISSET(sa, &readfds)) {
if
(read(sa, buf+idx, 1) < 1)
exit(1);
}
if (!ioctl(sc, SIOCGIFINDEX, &ifr)) {
/* Send message to BCM socket */
sendto(sc, &msg,
sizeof
(msg), 0,
(
struct
sockaddr*)&caddr,
sizeof
(caddr));
}
}
3.3.9.
connect
Description
Attempt to make a connection on socket.
Include files
#include <sys/socket.h>
Syntax
int connect(
int socket,
const struct sockaddr *address,
socklen_t address_len
)
Parameters
Socket
Socket file descriptor
address
Points to a sockaddr structure containing the peer address
address_len
Specifies the length of the address argument
Return value
Returns zero on success. In case of errors, -1 is returned and errno is set appropriately.
Example
See example of send.
www.crosscontrol.com
21