how to set a socket into non-buffering mode?

how to set a socket into non-buffering mode?

Post by Thomas Gehle » Fri, 11 Oct 1996 04:00:00



Hello!

I need some hints on setting a AF_INET/SOCK_STREAM socket to
non-buffering mode.

After creating and connecting the socket (which seems to succeed,
because no error is reported), I try to send data.

netstat then reports that the data is in the S-Que.

Because I need immediate delivery of every data-set, the buffer should
be flushed every time I do a write.

How can I manage this?

The code I've written looks like this:

...
getting host
getting service

  if ((unit = socket(AF_INET, SOCK_STREAM, 0)) < 0)
    {
      return (E_SOCKET_FAIL);
    }

  if (connect(unit, (struct sockaddr*) &s, sizeof(s)) < 0)
    {
      close(unit);
      return E_CONNECT_FAILED;
    }

-------- the data of the following write is buffered (up to 1024 bytes)
  if (write(unit, HELLO_MSG, sizeof(HELLO_MSG)) <0)
    {
        close(unit);    
    }

Please give me some hints, I  think there should be a ioctl() or
setsockopt() call which will do the job.

Thanks in advance,

                Thomas

--
-----------------------------------------------------
                    THOMAS GEHLER

                   TH-Darmstadt
        FB Flugmechanik &   Reglungstechnik
              Stick Gruppe (Thurecht)
                phone: (+49)6151-16-2290
                fax: (+49)6151-16-5434
              D-64287 Darmstadt Germany
-----------------------------------------------------

 
 
 

how to set a socket into non-buffering mode?

Post by David William » Fri, 11 Oct 1996 04:00:00




Quote:>Hello!

>I need some hints on setting a AF_INET/SOCK_STREAM socket to
>non-buffering mode.

>Please give me some hints, I  think there should be a ioctl() or
>setsockopt() call which will do the job.

>Thanks in advance,

>               Thomas

  set_sockopt TCP_NODELAY..
--
David Williams

 
 
 

how to set a socket into non-buffering mode?

Post by Roger L. Cordes, Jr » Tue, 15 Oct 1996 04:00:00



> I need some hints on setting a AF_INET/SOCK_STREAM socket to
> non-buffering mode.

Try:
        int     siz = 0;
        ...
        setsockopt(sock, SOL_SOCKET, SO_SNDBUF, &siz, sizeof(int));

Regards,
R.

 
 
 

how to set a socket into non-buffering mode?

Post by Andrew Gier » Tue, 15 Oct 1996 04:00:00



 >> I need some hints on setting a AF_INET/SOCK_STREAM socket to
 >> non-buffering mode.

 Roger> Try:
 Roger>      int     siz = 0;
 Roger>      ...
 Roger>      setsockopt(sock, SOL_SOCKET, SO_SNDBUF, &siz, sizeof(int));

I don't think so. This is a pretty useless thing to do.

--

"Ceterum censeo Microsoftam delendam esse" - Alain Knaff in nanam

 
 
 

1. 2.4.20-rc2aa1 refuses to boot into non frame buffer mode

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

When the vesa framebuffer is compiled into 2.4.20-rc2aa1 kernel it will boot
into the framebuffer mode even if I specify vga=normal at lilo. I had to
recompile it without framebuffer support since booting into framebuffer mode
gives very different benchmark results.

Con
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.0 (GNU/Linux)

iD8DBQE93ryNF6dfvkL3i1gRAuIjAJ41hqFkx7IYfpsAkn6aatbvU0LC6ACcD3HH
am2vn7vNSabkID0Xvz5VnWY=
=asQi
-----END PGP SIGNATURE-----
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in

More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

2. Problems During Oracle Installation on Solaris 9

3. Non-blocking socket and stdio line buffering

4. Possible to mount a msdos partition on to Soalris7 x86?

5. Semantics of non-blocking "passive"-mode SOCK_STREAM sockets

6. HELP New assistant blew away /etc/passwd on HP

7. setting non buffered io on stdi/stdout

8. lprm problem

9. How to set line buffered mode

10. Setting the buffer for a Socket.

11. Non-buffering using ioctl for stdin? (HATE getchar())

12. set socket send buffer size --- bug in Linux 2.0.x?

13. Reliable non-buffering removable filesystem