Re: How can I detect a carriage return using java.net



EJP wrote:
Martin Gregorie wrote:
Or, as I said earlier, it could be a deliberate implementation decision in the upper layers of the stack.

It is possible. It is extremely unlikely. It wouldn't comply with any known standard for Unix or sockets. I don't know anything about Fedora but it is certainly true that the Berkeley stacks deliver ECONNRESET, contrary to previous assertions.

An OS with this bug wouldn't be able to make any practical use of TCP/IP or the Internet.
>
The stack used by DEC Unix on the alphaserver did the same - and that was a Mach based implementation.

Actually, its a pretty benign fault, if it is one. It certainly doesn't make socket connections unusable. Any time a recv() or read() returns a positive value you know you've got data. If you get <=0 the connection has been dropped and you need to clean up and recover. If you got an error you can report it, but this doesn't affect the logic unless it was EAGAIN or EINTR, which both indicate that the recv() returned without reading any valid data but the connection is still intact.

My copy of "UNIX Systems Programming for SVR4" implies that this behavior is the norm from its examples, which all use logic of the form:

while((n = recv()) >0)
process the message
if (n < 0)
decode errno and output the error message
stop.

and the Linux manpage says more or less the same. Neither explicitly mentions any error indicating that the connection has failed.


--
martin@ | Martin Gregorie
gregorie. | Essex, UK
org |
.



Relevant Pages

  • Re: Alpha remembrance day
    ... DEC's disk drive business, they were starting to catch on, but since ... to integrate a TCP/IP stack into on OS? ... UNIX Server/Workstation. ... IBM courted him for a long while ...
    (comp.os.vms)
  • Re: BlueTooth stacks (WidComm, BroadComm, MS) (peter?)
    ... ports might not be suitable, on most devices you are limited to a single ... devices when you try to establish a connection, ... > B. Delorme EarthMate GPS Bluetooth logger. ... >> both have advantages and disadvantages, the Microsoft stack has a free ...
    (microsoft.public.dotnet.framework.compactframework)
  • Re: Signs of Maccie desperation!
    ... they cannot be implemented in UNIX? ... Network mapping magically detects what your ... Same with the new stack. ... interface, and a ton load of new technologies in the file system, kernel, ...
    (comp.sys.mac.advocacy)
  • Re: BT Stack under WM2005
    ... Under WM5.0 (with the Microsoft stack) once you have paired a device you can view it's properties in Settings> Connections> Bluetooth and view the properties, if you check Serial Port and save you can then go to the COM Ports tab of the Bluetooth settings applet and map an outgoing COM port to your device. ... Although there's always one preliminary step I have to take prior to engaging this kind of communication: I've either got to use the built-in GPS manager, which is unfortunately hidden under WM5 by default in order to map COM ports to the incoming data from Picoplug. ... Every time I restart a programme which is attempting to communicate with the Picoplug, connection gets established but only to break down a few seconds later. ...
    (microsoft.public.pocketpc.developer)
  • Re: transparent printer with pc
    ... >> the unix server was right there in their office....so the first ... the connection TO the unix server from the ... Somewhere in your application configuration file, ... forwarded port and nc for windows (the ...
    (comp.unix.sco.misc)