Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.os.linux.networking > #1094
| From | Jerry Peters <jerry@example.invalid> |
|---|---|
| Newsgroups | comp.os.linux.networking |
| Subject | Re: Data sent through sockets are *sometimes* inverted ?!!! |
| Date | 2012-02-23 21:34 +0000 |
| Organization | A noiseless patient Spider |
| Message-ID | <ji6bcv$ge4$1@dont-email.me> (permalink) |
| References | (4 earlier) <1b1upq6ssg.fsf@pfeifferfamily.net> <slrnjk42um.1ls.grahn+nntp@frailea.sa.invalid> <slrnjk9bds.1ls.grahn+nntp@frailea.sa.invalid> <ji3s0a$cl5$1@dont-email.me> <slrnjkb15v.1ls.grahn+nntp@frailea.sa.invalid> |
Jorgen Grahn <grahn+nntp@snipabacken.se> wrote: > On Wed, 2012-02-22, Jerry Peters wrote: >> Jorgen Grahn <grahn+nntp@snipabacken.se> wrote: >>> On Mon, 2012-02-20, Jorgen Grahn wrote: >>>> On Mon, 2012-02-20, Joe Pfeiffer wrote: >>>>> Jorgen Grahn <grahn+nntp@snipabacken.se> writes: >>>>> >>>>>> On Fri, 2012-02-17, Joe Pfeiffer wrote: >>> ... >>>>>>> write() is also not guaranteed to send all the bytes out in a single >>>>>>> try, so careful programming would require a similar loop for your >>>>>>> write()s. I've never actually seen a write() do anything but either >>>>>>> send all the bytes or else fail, however. >>>>>> >>>>>> Have you looked? If you have a TCP socket with just N bytes of free Tx >>>>>> buffer, and you write N+1 bytes to it, I'd expect a partial write to >>>>>> happen. I'd consider /not/ handling that case a serious bug. >>>>> >>>>> Yes, I have -- as part of debugging more instances than I want to admit >>>>> to of discovering I wasn't doing a good enough job of what we discuss >>>>> above. >>>>> >>>>> I've wound up dumping lots and lots of "tried to write %d, write >>>>> returned %d" and I can't remember ever seeing an instance of something >>>>> other than -1 or what I was trying to send. It's an easy enough >>>>> loop to write that I always do it (you're right, not handling the case >>>>> would be a bug that might turn up now and might turn up in a decade), >>>>> but so far I can't remember ever going around that loop twice. >>>> >>>> Interesting -- I must try it tonight. (On Linux, since I don't have >>>> easy access to any other Unix outside work.) >>> >>> So far I have failed to disprove what you wrote. Netcat to a >>> SIGSTOPped server, until first the server's RX buffer got filled and >>> then the client's TX buffer got filled. The client blocked instead of >>> performing a partial write. > >> What happens if you set the socket to non-blocking? > > Something else, probably. But at this point I'd rather look at the > linux/net/ sources -- when I have the time and energy. > > Noone here has claimed that you don't need to check for partial writes, > but it could be very useful to know (e.g. for debugging purposes) how > Linux behaves in this case. > > /Jorgen > Why? The behavior could change at the next kernel upgrade. But how do you know how it behaves in all circumstances? What about a loaded server, where the problem is *NOT* the client has stopped accepting packets, but the server is running low on transmit buffers? Jerry
Back to comp.os.linux.networking | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
Data sent through sockets are *sometimes* inverted ?!!! mast4as <mast4as@yahoo.com> - 2012-02-17 00:38 -0800
Re: Data sent through sockets are *sometimes* inverted ?!!! Chris Davies <chris-usenet@roaima.co.uk> - 2012-02-17 09:50 +0000
Re: Data sent through sockets are *sometimes* inverted ?!!! Jorgen Grahn <grahn+nntp@snipabacken.se> - 2012-02-17 10:25 +0000
Re: Data sent through sockets are *sometimes* inverted ?!!! Joe Pfeiffer <pfeiffer@cs.nmsu.edu> - 2012-02-17 13:42 -0700
Re: Data sent through sockets are *sometimes* inverted ?!!! Jorgen Grahn <grahn+nntp@snipabacken.se> - 2012-02-19 19:50 +0000
Re: Data sent through sockets are *sometimes* inverted ?!!! Joe Pfeiffer <pfeiffer@cs.nmsu.edu> - 2012-02-19 21:19 -0700
Re: Data sent through sockets are *sometimes* inverted ?!!! Jorgen Grahn <grahn+nntp@snipabacken.se> - 2012-02-20 09:01 +0000
Re: Data sent through sockets are *sometimes* inverted ?!!! Jorgen Grahn <grahn+nntp@snipabacken.se> - 2012-02-22 08:56 +0000
Re: Data sent through sockets are *sometimes* inverted ?!!! Jerry Peters <jerry@example.invalid> - 2012-02-22 22:59 +0000
Re: Data sent through sockets are *sometimes* inverted ?!!! Jorgen Grahn <grahn+nntp@snipabacken.se> - 2012-02-23 00:13 +0000
Re: Data sent through sockets are *sometimes* inverted ?!!! Ralph Spitzner <rasp@spitzner.org> - 2012-02-23 06:00 +0100
Re: Data sent through sockets are *sometimes* inverted ?!!! Jorgen Grahn <grahn+nntp@snipabacken.se> - 2012-02-23 07:34 +0000
Re: Data sent through sockets are *sometimes* inverted ?!!! Chris Davies <chris-usenet@roaima.co.uk> - 2012-02-23 11:12 +0000
Re: Data sent through sockets are *sometimes* inverted ?!!! Rick Jones <rick.jones2@hp.com> - 2012-02-24 19:25 +0000
Re: Data sent through sockets are *sometimes* inverted ?!!! Chris Davies <chris-usenet@roaima.co.uk> - 2012-02-24 21:03 +0000
Re: Data sent through sockets are *sometimes* inverted ?!!! Jorgen Grahn <grahn+nntp@snipabacken.se> - 2012-02-25 04:49 +0000
Re: Data sent through sockets are *sometimes* inverted ?!!! Chris Davies <chris-usenet@roaima.co.uk> - 2012-02-26 12:18 +0000
Re: Data sent through sockets are *sometimes* inverted ?!!! Pascal Hambourg <boite-a-spam@plouf.fr.eu.org> - 2012-02-26 14:10 +0100
Re: Data sent through sockets are *sometimes* inverted ?!!! Jorgen Grahn <grahn+nntp@snipabacken.se> - 2012-02-26 14:02 +0000
Re: Data sent through sockets are *sometimes* inverted ?!!! Ralph Spitzner <rasp@spitzner.org> - 2012-02-23 17:03 +0100
Re: Data sent through sockets are *sometimes* inverted ?!!! Joe Pfeiffer <pfeiffer@cs.nmsu.edu> - 2012-02-23 10:17 -0700
Re: Data sent through sockets are *sometimes* inverted ?!!! Grant Edwards <invalid@invalid.invalid> - 2012-02-23 19:13 +0000
Failing TCP checksums (was Re: Data sent through sockets are *sometimes* inverted ?!!!) Jorgen Grahn <grahn+nntp@snipabacken.se> - 2012-02-23 20:40 +0000
Re: Data sent through sockets are *sometimes* inverted ?!!! Jerry Peters <jerry@example.invalid> - 2012-02-23 21:34 +0000
Re: Data sent through sockets are *sometimes* inverted ?!!! Jorgen Grahn <grahn+nntp@snipabacken.se> - 2012-02-23 22:12 +0000
Re: Data sent through sockets are *sometimes* inverted ?!!! Grant Edwards <invalid@invalid.invalid> - 2012-02-24 15:23 +0000
Re: Data sent through sockets are *sometimes* inverted ?!!! Jorgen Grahn <grahn+nntp@snipabacken.se> - 2012-02-25 10:54 +0000
Re: Data sent through sockets are *sometimes* inverted ?!!! Richard Kettlewell <rjk@greenend.org.uk> - 2012-02-17 10:07 +0000
csiph-web