Hello... I'm trying to recevie data on a UDP style socket...Up to here everything should be OK.
This is the sequence of commands to SCTP I have tried.
1-------------- Server side ------------------------
fd = ext_socket(PF_INET, SOCK_SEQPACKET, IPPROTO_SCTP);
2-----------------------------------------------
struct sctp_initmsg initmsg;
initmsg.sinit_num_ostreams = 100;
initmsg.sinit_max_instreams = 1;
initmsg.sinit_max_attempts = 0;
initmsg.sinit_max_init_timeo = 60;
if (ext_setsockopt(fd, IPPROTO_SCTP, SCTP_INITMSG, &initmsg,
sizeof(initmsg)) < 0) {
perror("setsockopt SCTP_INITMSG");
exit(1);
}
3------------------------------------------------
sin->sin_family = AF_INET;
sin->sin_port = htons(APP_PORT);
sin->sin_addr.s_addr = INADDR_ANY;
ext_bind(fd, (struct sockaddr *)sin, sizeof (*sin));
4-------------------------------------------------
ext_listen(fd, 1)
5--------------------------------------------------
buf = (char*)sctp_recvmsg(fd, msg, buf, &buflen, &nr);
//from idexample.c in socket_programs
upon a assoc_change notif the program continue and try to reply with data onFrom the man page of send:
by using
6---------------------------------------------------
ext_send(fd,msg,0);
That is why you must use sendmsg.
The message contain both the address of the peer, received with the
assoc_change, and dito assoc_id in the sndrcvinfo structure...
------------------------------------------------------Why are you calling connect? This is not necessary. Simply call
------------------------------------------------------
1-------------- Client side ------------------------
fd = ext_socket(PF_INET, SOCK_SEQPACKET, IPPROTO_SCTP);
2-----------------------------------------------
struct sctp_initmsg initmsg;
initmsg.sinit_num_ostreams = 1;
initmsg.sinit_max_instreams = 100;
initmsg.sinit_max_attempts = 0;
initmsg.sinit_max_init_timeo = 60;
if (ext_setsockopt(fd, IPPROTO_SCTP, SCTP_INITMSG, &initmsg,
sizeof(initmsg)) < 0) {
perror("setsockopt SCTP_INITMSG");
exit(1);
}
3------------------------------------------------
sin->sin_family = AF_INET;
sin->sin_port = htons(APP_PORT);
sin->sin_addr.s_addr = INADDR_ANY;
ext_bind(fd, (struct sockaddr *)sin, sizeof (*sin));
4-------------------------------------------------
ext_connect(fd,(struct sockaddr*)sin,sizeof(struct sockaddr));
Hmm. Both your client and server are calling sctp_recv first. How
5--------------------------------------------------
buf = (char*)sctp_recvmsg(fd, msg, buf, &buflen, &nr);
//from idexample.c in socket_programs
--------------------------------------------------are you talking about ext_recvmsg or sctp_recvmsg? Please post the source code.
--------------------------------------------------
On the client side the (5) ext_recvmsg() returns null and sometimes crashes.
Not sure :( ...I do not understand why your server can send anything, but ethereal is
I use ethereal to se what happens on the network and all the data is
transfered correctly...
Please post the source code such that we can debug the error handling of the
Does anyone have any comments about this ?
Michael.Tuexen AT micmac.franken.de
/Torbjörn
_______________________________________________
discussion mailing list
discussion AT sctp.de
http://www.sctp.de/mailman/listinfo/discussion
Archive powered by MHonArc 2.6.19+.