SCTP Discussions

Text archives Help


[SCTP-Discussion] Re: SCTP 2 stream application


Chronological Thread 
  • From: Thomas Dreibholz <dreibh AT exp-math.uni-essen.de>
  • To: martin.nilsson AT naszatel.com
  • Cc: discussion AT sctp.de
  • Subject: [SCTP-Discussion] Re: SCTP 2 stream application
  • Date: Thu Nov 28 13:37:01 2002
  • List-id: SCTP Discussions <discussion.sctp.de>

Please send e-mails to me only as plain text, not HTML. Since I am receiving
a steadily increasing amount of spam, I configured our spam filter with low
thresholds. SpamAssassin intercepted your mail and moved it to a spam folder,
since your HTML mail looked very similar to a spam mail. I usually do not
check this folter every day, so answers to such mails will usually take much
longer.

-----
I'm a student and I'm have some basic knowledge of SCTP (I
have read all rfcs and drafts quite well I hope) and some basic
knowledge of socket programming ("UNIX socket programming" by Stevens).
I have a project to write: to program an SCTP client and an SCTP server.
The client should open two streams to the server. The bytes (a large
amount) sent on one stream should be discarded, while the bytes (a small
amount, from time to time) sent on the second stream should be echoed.
How could I do that? What should I basically do? Will I need any
multi-threading knowledge (which I don't have?)? Can I use the
sctplib1.0.0.-preXX written by Michael, Andreas and you?
-----

You do not need multithreading knowledge. If you want to support multiple
clients simultaneously connected to your server, simply use ext_select() to
wait for data on any of the open connections.

Your server could look like this

create socket (listenSocket=ext_socket())
bind socket (ext_bind(listenSocket,...) or
initmsg.sinit_max_instreams=2;
initmsg.sinit_max_ostreams=2;
ext_setsockopt(listenSocket,initmsg)
ext_bindx(listenSocket,...))
listen (ext_listen(listenSocket))
while(!abort) {
collect all FDs for ext_select()
ext_select()
if(listenSocket has data) {
newSocket = ext_accpet(listenSocket)
add newSocket to clientFDset
}
for all(clientSockets from clientFDset that have data) {
ext_readmsg(clientSocket)
if(error) {
ext_close(clientSocket)
remove clientSocket from clientFDset
}
else {
extract streamID from msg->control ...
if(streamID == 0) {
// do nothing
}
else if(streamID == 1) {
// Echo data back
ext_sendmsg(clientSocket,...)
}
}
}
}

Have a look at the socket API draft
http://www.ietf.org/internet-drafts/draft-ietf-tsvwg-sctpsocket-05.txt for
more information about the SCTP socket API.


Best regards

--
Thomas Dreibholz
Universität Essen
Institut für Experimentelle Mathematik
Ell



  • [SCTP-Discussion] Re: SCTP 2 stream application, Thomas Dreibholz, 11/28/2002

Archive powered by MHonArc 2.6.19+.

Top of page