Giter Club home page Giter Club logo

Comments (8)

stewrtrs avatar stewrtrs commented on July 17, 2024

what type of socket are you using?

one-to-one or one-to-many?

For the one-to-one the asoc-id has no meaning.. only the one-to-many I think..

R
On Jan 21, 2016, at 5:47 AM, Timo Schwarz [email protected] wrote:

Using one-to-many style sockets I want to establish a completely new association to my server by sending the first data packets using usrsctp_sendv()
As I will need the association ID of the newly established association in the future, I set infotype to SCTP_SENDV_SNDINFO and supply an all-NULL struct sctp_sndinfo
According to the RFC, when usrsctp_sendv() returns, the snd_assoc_id field should contain the association ID:
RFC6458, Page 100

"For a one-to-many style socket, if the struct sctp_sndinfo attribute
is provided, the snd_assoc_id field must be 0 When this function
returns, the snd_assoc_id field will contain the association
identifier of the newly established association"

Unfortunately it doesn't, snd_assoc_id will still be 0


Reply to this email directly or view it on GitHub.


Randall Stewart
[email protected]
803-317-4952

from usrsctp.

legion47T avatar legion47T commented on July 17, 2024

One-to-many, as I stated above.

from usrsctp.

stewrtrs avatar stewrtrs commented on July 17, 2024

Oh sorry I missed that.. this must be a bug then in the user implementation since
I know the kernel code always gives a asoc-id… I have not ever used the user
space stack (heck I hardly have time to poke at the kernel version right now).. but
I know the kernel world always gives an asoc-id.. this definitely is a bug then :-o

R
On Jan 21, 2016, at 7:04 AM, Timo Schwarz [email protected] wrote:

One-to-many, as I stated above.


Reply to this email directly or view it on GitHub.


Randall Stewart
[email protected]
803-317-4952

from usrsctp.

tuexen avatar tuexen commented on July 17, 2024

This is a bug, even in the kernel implementation, since you don't get the assoc-id via the cmsg back.
This feature is required for sctp_sendx() and sctp_sendv(). Will fix it for the userland and kernel stack...

from usrsctp.

legion47T avatar legion47T commented on July 17, 2024

That's great, thank you!

from usrsctp.

tuexen avatar tuexen commented on July 17, 2024

Let me know if it also fixed for you.

Best regards
Michael

from usrsctp.

tuexen avatar tuexen commented on July 17, 2024

Just for documentation. This is the program I used for testing on Mac OS X:

#include <sys/types.h>
#include <sys/socket.h>
#include <netinet/in.h>
#include <arpa/inet.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#include <usrsctp.h>

#define ADDR "127.0.0.1"
#define PORT 9

int
main(void)
{
    struct socket *sock;
    struct sockaddr_in addr;
    ssize_t n;
    char *buffer = "This is a test message";
    struct sctp_sndinfo sndinfo;

    usrsctp_init(0, NULL, NULL);
    usrsctp_sysctl_set_sctp_blackhole(2);
    if ((sock = usrsctp_socket(AF_INET, SOCK_SEQPACKET, IPPROTO_SCTP, NULL, NULL, 0, NULL)) == NULL) {
        perror("usrsctp_socket");
    }
    memset((void *)&addr, 0, sizeof(struct sockaddr_in));
    addr.sin_len = sizeof(struct sockaddr_in);
    addr.sin_family = AF_INET;
    addr.sin_port = htons(PORT);
    addr.sin_addr.s_addr = inet_addr(ADDR);
    memset(&sndinfo, 0, sizeof(struct sctp_sndinfo));
    sndinfo.snd_sid = 1;
    sndinfo.snd_flags = SCTP_UNORDERED;
    sndinfo.snd_ppid = htonl(1234);
    sndinfo.snd_context = 2048;
    sndinfo.snd_assoc_id = 0;
    n = usrsctp_sendv(sock, buffer, strlen(buffer), (struct sockaddr *)&addr, 1, &sndinfo, (socklen_t)sizeof(struct sctp_sndinfo), SCTP_SENDV_SNDINFO, 0);
    printf("usrsctp_sendv() returned %zd, snd_assoc_id = %u\n", n, sndinfo.snd_assoc_id);
    sndinfo.snd_sid = 2;
    sndinfo.snd_flags = SCTP_UNORDERED;
    sndinfo.snd_ppid = htonl(2048);
    sndinfo.snd_context = 4096;
    n= usrsctp_sendv(sock, buffer, strlen(buffer), NULL, 0, &sndinfo, (socklen_t)sizeof(struct sctp_sndinfo), SCTP_SENDV_SNDINFO, 0);
    printf("usrsctp_sendv() returned %zd, snd_assoc_id = %u\n", n, sndinfo.snd_assoc_id);
    usrsctp_close(sock);
    while (usrsctp_finish() != 0) {
        sleep(1);
    }
    return(0);
}

from usrsctp.

legion47T avatar legion47T commented on July 17, 2024

The association ID is returned correctly after sendv now, so it's also fixed for me.
Thanks again!

from usrsctp.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.