SCTP Discussions

Text archives Help


[SCTP-Discussion] UDP style problem


Chronological Thread 
  • From: Torbjorn Andersson <tora AT tora-pc.cs.kau.se>
  • To: discussion AT sctp.de
  • Subject: [SCTP-Discussion] UDP style problem
  • Date: Thu Jun 13 15:52:00 2002
  • List-id: SCTP Discussions <discussion.sctp.de>

Hello... I'm trying to recevie data on a UDP style socket...
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 on
by using

6---------------------------------------------------
ext_send(fd,msg,0);

The message contain both the address of the peer, received with the
assoc_change, and dito assoc_id in the sndrcvinfo structure...

------------------------------------------------------
------------------------------------------------------

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));

5--------------------------------------------------

buf = (char*)sctp_recvmsg(fd, msg, buf, &buflen, &nr);
//from idexample.c in socket_programs

--------------------------------------------------
--------------------------------------------------

On the client side the (5) ext_recvmsg() returns null and sometimes crashes.
Not sure :( ...

I use ethereal to se what happens on the network and all the data is
transfered correctly...

Does anyone have any comments about this ?

/Torbjörn






Archive powered by MHonArc 2.6.19+.

Top of page