Hello,

In Linux, I can disconnect the socket using:
sa.sin_family = AF_UNSPEC;
val = connect(sockfd, (struct sockaddr *)&sa, sizeof(sa));

the return value of val is 0; on freebsd, the return value of connect() is -1.
According to Linux's connect(2) man page:

Connectionless sockets may dissolve
the association by connecting to an address with the  sa_family  member
of sockaddr set to AF_UNSPEC

but FreeBSD's connect says:
Datagram sockets may dissolve the association by connecting
 to an invalid address, such as a null address.

I try to convert above code to
memset(&sa, 0, sizeof(sa));
sa.sin_addr.s_addr = htonl(INADDR_ANY);
val = connect(sockfd, (struct sockaddr *)&sa, sizeof(sa));

the return value of val still -1. Any idea? Thanks.

Regards,
Dave.
_______________________________________________
freebsd-net@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-net
To unsubscribe, send any mail to "freebsd-net-unsubscr...@freebsd.org"

Reply via email to