Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 4 Dec 2011 17:15:10 +0100
From:      =?iso-8859-1?Q?Michael_T=FCxen?= <Michael.Tuexen@lurchi.franken.de>
To:        jyl_2006 <yilinjing2006@gmail.com>
Cc:        freebsd-net@freebsd.org
Subject:   Re: the return value of sctp_connectx do not match any error
Message-ID:  <F2E9EABF-175E-418C-8E52-0DDF4BF483F0@lurchi.franken.de>
In-Reply-To: <1323004488998-5046216.post@n5.nabble.com>
References:  <1322888085250-5043901.post@n5.nabble.com> <C6A45788-E86B-4825-A4A6-2859B74D110B@lurchi.franken.de> <1322919283456-5044536.post@n5.nabble.com> <76108404-D722-48D0-AAAA-F35B77F5CFCF@lurchi.franken.de> <1322966561294-5045598.post@n5.nabble.com> <F9593CD9-520A-49D4-9093-7DA02DDEE521@lurchi.franken.de> <1323000072198-5046113.post@n5.nabble.com> <ED9B11CB-4442-44C2-86EC-A2F7AC86C8E4@lurchi.franken.de> <1323001847851-5046165.post@n5.nabble.com> <3E25BC69-1FC8-487E-BBAD-8BAF2552623B@lurchi.franken.de> <1323004488998-5046216.post@n5.nabble.com>

next in thread | previous in thread | raw e-mail | index | archive | help
On Dec 4, 2011, at 2:14 PM, jyl_2006 wrote:

> Yes, besides "127.0.0.1" , I also test between two computer, each one =
have ip
> address of wlan.The question still remains.
OK, I have tested RC2 i386 and it works. I don't have a Beta 2 system...
I have no idea what the problem might be... What does the following =
program
report?

Best regards
Michael

#include <sys/errno.h>
#include <stdio.h>
#include <string.h>
#include <stdlib.h>

#include <netinet/in.h>
#include <netinet/sctp.h>
#include <sys/types.h>
#include <sys/socket.h>
#define PORT 63000

int main()
{
	int _sctp_socket, ret;
	sctp_assoc_t _sctp_associd;
	struct sockaddr *show_ip_address =3D NULL;
	int size_of_addresses;
	socklen_t siz;
	struct sctp_getaddresses *addrs;

	_sctp_socket =3D socket( AF_INET , SOCK_SEQPACKET , IPPROTO_SCTP =
);

	struct sockaddr_in server_ipaddress;
	server_ipaddress . sin_family =3D AF_INET;
	server_ipaddress . sin_port =3D htons(PORT);
	server_ipaddress . sin_len =3D sizeof(struct sockaddr_in);
	server_ipaddress . sin_addr.s_addr =3D inet_addr("127.0.0.1");

	ret =3D sctp_connectx(_sctp_socket , (struct sockaddr*) =
&server_ipaddress , 1, &_sctp_associd);
	if( ret < 0)
	{
		printf("sctp_connectx error");
	}
	size_of_addresses =3D 0;
	siz =3D sizeof(int);
	if (getsockopt(_sctp_socket, IPPROTO_SCTP, =
SCTP_GET_LOCAL_ADDR_SIZE, &size_of_addresses, &siz) !=3D 0) {
		perror("SCTP_GET_LOCAL_ADDR_SIZE");=09
		return (-1);
	}
	printf("size_of_addresses =3D %d.\n", size_of_addresses);
	siz =3D size_of_addresses + sizeof(struct sockaddr_storage);
	siz +=3D sizeof(struct sctp_getaddresses);
	addrs =3D calloc(1, siz);
	addrs->sget_assoc_id =3D _sctp_associd;
	if (getsockopt(_sctp_socket, IPPROTO_SCTP, =
SCTP_GET_LOCAL_ADDRESSES, addrs, &siz) !=3D 0) {
		perror("SCTP_GET_LOCAL_ADDRESSES");
		return (-1);
	}
	printf("siz =3D %u.\n", siz);
	free(addrs);
	return (0);
}


>=20
> --
> View this message in context: =
http://freebsd.1045724.n5.nabble.com/the-return-value-of-sctp-connectx-do-=
not-match-any-error-tp5041952p5046216.html
> Sent from the freebsd-net mailing list archive at Nabble.com.
> _______________________________________________
> freebsd-net@freebsd.org mailing list
> http://lists.freebsd.org/mailman/listinfo/freebsd-net
> To unsubscribe, send any mail to "freebsd-net-unsubscribe@freebsd.org"
>=20




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?F2E9EABF-175E-418C-8E52-0DDF4BF483F0>