Date: Mon, 3 Aug 2009 08:19:26 +0000 From: Maslan <maslanbsd@gmail.com> To: FreeBSD Hackers <freebsd-hackers@freebsd.org> Subject: sosend() and mbuf Message-ID: <319cceca0908030119i3432a495ya60aa431dab0e1b1@mail.gmail.com>
next in thread | raw e-mail | index | archive | help
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
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?319cceca0908030119i3432a495ya60aa431dab0e1b1>