From owner-freebsd-hackers@FreeBSD.ORG Mon Aug 3 08:44:44 2009 Return-Path: Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id C34FC1065673 for ; Mon, 3 Aug 2009 08:44:44 +0000 (UTC) (envelope-from maslanbsd@gmail.com) Received: from mail-bw0-f206.google.com (mail-bw0-f206.google.com [209.85.218.206]) by mx1.freebsd.org (Postfix) with ESMTP id 4F4CE8FC1E for ; Mon, 3 Aug 2009 08:44:43 +0000 (UTC) (envelope-from maslanbsd@gmail.com) Received: by bwz2 with SMTP id 2so2177931bwz.43 for ; Mon, 03 Aug 2009 01:44:43 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:received:date:message-id:subject :from:to:content-type:content-transfer-encoding; bh=XArBq8fuNWsXuZOJcZWtKOJtJj7hwcM/R5iIqi4qZRg=; b=KuA7XKoR9hsED+JX2l/LyrSJvt8CefDZUFER/QfBBicRatxfauUHHiM10Pjqm3fEHQ +haf8PYaoniJiF2OKtfyEECqW6VtZdf8ZrvNO6w+AG4iK/p6U3lMPJwhZhw8sXLYayD+ VTPzIPTOUiqCqdirXNWRYWMbUCuNQjFtwOWkI= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:date:message-id:subject:from:to:content-type :content-transfer-encoding; b=ciW8/DAACb7hGnqyEQYidb+NQuKtPy9SUvSN3OW93GHbgwqMV+EpjwRIEJWgN1noxN ZuHdFcRRmViVEOCJUhelpnjRj0DN6iB/mFaWRLGohgxVUGZV/BxYinoI62zkpouVcN9O Zo2tNTs7whxMrcUaj9/JZ4dRqpenZK/n8uTV8= MIME-Version: 1.0 Received: by 10.204.102.14 with SMTP id e14mr574747bko.183.1249287566294; Mon, 03 Aug 2009 01:19:26 -0700 (PDT) Date: Mon, 3 Aug 2009 08:19:26 +0000 Message-ID: <319cceca0908030119i3432a495ya60aa431dab0e1b1@mail.gmail.com> From: Maslan To: FreeBSD Hackers Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Subject: sosend() and mbuf X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 03 Aug 2009 08:44:45 -0000 Hello Guys, I can't find useful information on sosend(), I would like to send some plain text through sosend() Here is what i got so far, I don't know how to use mbuf with sosend() to achieve this. ret = socreate(PF_INET, &s, SOCK_STREAM, IPPROTO_TCP, curthread->td_ucred, curthread); printf("socreate -> %d\n", ret); bzero(&sa, sizeof(sa)); sa.sin_len = sizeof(sa); sa.sin_family = AF_INET; sa.sin_port = htons(8888); sa.sin_addr.s_addr = INADDR_ANY; sobind(s, (struct sockaddr *)&sa, curthread); printf("sobind -> %d\n", ret); ret = solisten(s, 4, curthread); printf("solisten -> %d\n", ret); ret = soaccept(s, (struct sockaddr**)&psa); printf("soaccept -> %d\n", ret); tsleep(curthread, PDROP, "kHTTP tsleep", 10*hz); /* iovec */ aiov.iov_base = buf; aiov.iov_len = strlen(buf); /* auio */ auio.uio_iov = &aiov; auio.uio_iovcnt = 1; auio.uio_offset = 0; auio.uio_resid = strlen(buf); auio.uio_rw = UIO_WRITE; auio.uio_segflg = UIO_SYSSPACE; auio.uio_td = curthread; --------> ret = sosend(s, (struct sockaddr*)&sa, &auio, 0, 0, 0, curthread); printf("sosend -> %d\n", ret); ret = soclose(s); printf("soclose -> %d\n", ret); Thanks a lot