Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 4 Dec 2011 10:11:46 +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:  <F9593CD9-520A-49D4-9093-7DA02DDEE521@lurchi.franken.de>
In-Reply-To: <1322966561294-5045598.post@n5.nabble.com>
References:  <1322834879026-5041952.post@n5.nabble.com> <0D6FA7F2-1462-44EF-98F4-3B6AFC856757@lurchi.franken.de> <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>

next in thread | previous in thread | raw e-mail | index | archive | help
On Dec 4, 2011, at 3:42 AM, jyl_2006 wrote:

> Sorry.The return value is -1, that means sctp_getladdrs() and
> sctp_getpaddrs() encounter an error. And the errno is set to ENOMEM.
Can you provide a test program showing this?

I changed your client and this works on a FreeBSD head system. Does it =
fail on your?

Best regards
Michael

#include <sys/errno.h>
#include <stdio.h>
#include <string.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;

        _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");
       }
        ret =3D sctp_getladdrs(_sctp_socket, _sctp_associd, =
&show_ip_address);
        printf("sctp_getladdrs() returned %d.\n", ret);
        if (ret > 0)
        {
                sctp_freeladdrs(show_ip_address);
        }

}


>=20
> --
> View this message in context: =
http://freebsd.1045724.n5.nabble.com/the-return-value-of-sctp-connectx-do-=
not-match-any-error-tp5041952p5045598.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?F9593CD9-520A-49D4-9093-7DA02DDEE521>