From owner-freebsd-net@FreeBSD.ORG Wed Mar 5 10:11:08 2008 Return-Path: Delivered-To: freebsd-net@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 700CF1065670 for ; Wed, 5 Mar 2008 10:11:08 +0000 (UTC) (envelope-from freebsd-net@m.gmane.org) Received: from ciao.gmane.org (main.gmane.org [80.91.229.2]) by mx1.freebsd.org (Postfix) with ESMTP id E853E8FC1D for ; Wed, 5 Mar 2008 10:11:07 +0000 (UTC) (envelope-from freebsd-net@m.gmane.org) Received: from list by ciao.gmane.org with local (Exim 4.43) id 1JWqaV-0003EU-QZ for freebsd-net@freebsd.org; Wed, 05 Mar 2008 10:11:03 +0000 Received: from 195.208.174.178 ([195.208.174.178]) by main.gmane.org with esmtp (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Wed, 05 Mar 2008 10:11:03 +0000 Received: from vadim_nuclight by 195.208.174.178 with local (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Wed, 05 Mar 2008 10:11:03 +0000 X-Injected-Via-Gmane: http://gmane.org/ To: freebsd-net@freebsd.org From: Vadim Goncharov Date: Wed, 5 Mar 2008 10:10:55 +0000 (UTC) Organization: Nuclear Lightning @ Tomsk, TPU AVTF Hostel Lines: 57 Message-ID: X-Complaints-To: usenet@ger.gmane.org X-Gmane-NNTP-Posting-Host: 195.208.174.178 X-Comment-To: All User-Agent: slrn/0.9.8.1 (FreeBSD) Sender: news Subject: SCTP using questions (API etc.) X-BeenThere: freebsd-net@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list Reply-To: vadim_nuclight@mail.ru List-Id: Networking and TCP/IP with FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 05 Mar 2008 10:11:08 -0000 Hi! I've seen that FreeBSD 7.0 is a reference implementation for SCTP, which is a great protocol, good work! But as I was looking through man pages for new API, I couldn't understand some issues with high-load servers. Currently, I am developing client-server application for my needs, and I want to adjust protocol right now to ease possible transition to SCTP later when it becomes wider available. Protocol uses TCP, it breaks stream to variable-sized records (length in header up to 64K) and multiplexes several "substreams". SCTP can do it for me, it's wonderful, but in practice there are some questions. How long can be one particular SCTP message? Can I rely on the fact that it can be unbounded, e.g. I want to emulate a stream with transfer of 6 Gig-sized file? Can I use 32-bit PPID field for my own headers/arbitrary values or I must register that numbers somewhere before using? Can a message be of zero-length data (only headers) ? What is the relation between SCTP streams in both directions? Can streams be opened and closed on-demand, like SSH port forwarding (yet again multiplexing example) or they are preallocated at connection setup all together? What is the minimum number of streams application can rely upon (or it just one stream 0 in general case) ? Another important questions are related with blocking and non-blocking I/O. With TCP servers I have two models: in one a thread/process per client (usually blocking), in other - a single-threaded FSM (Finite-State Machine) serving all clients using select()/poll()/kqueue()/etc. Both rely on the usual UNIX way of creading new file descriptor on accept(). My server currently uses FSM model, but question is interesting for both. I didn't find any words about descriptor duplication or non-blocking I/O in SCTP man pages. How can I put request to kernel for a connect, for example, and then sleep until connect will complete or event in some another descriptor will occur? How can I put each client to it's fd and then do a kqueue()/kevent() on a set of those fd's (and other items) ? It is very handy to have this architecture as kevent() allows to store an arbitrary void* in it's structure which I can later use to quickly dispatch events. And, of course, all this usual C10K-problem-solving-TCP-server tricks I want with basic SCTP SEQPACKET benefits: multiple streams and message record separation (I don't need other SCTP features currently). Where can I find answers to these questions, like it was with W.R.Stevens books for TCP ?.. -- WBR, Vadim Goncharov. ICQ#166852181 mailto:vadim_nuclight@mail.ru [Moderator of RU.ANTI-ECOLOGY][FreeBSD][http://antigreen.org][LJ:/nuclight]