Skip to content
Tcl Source Code Ticket Change Details
Login

Ticket Change Details

Overview

Artifact ID: 52b1b4e2cdcf143894ea89b4be02f6acc621fda8
Ticket: 218047ffffffffffffffffffffffffffffffffff
Reading data from socket on Windows appends extra '0' value
User & Date: nobody on 2000-10-26 00:52:33
Changes

  1. assignee changed to: "nobody"
  2. cmimetype changed to: "text/plain"
  3. comment changed to:
    OriginalBugID: 1398 Bug
    Version: 8.0.4
    SubmitDate: '1999-03-02'
    LastModified: '2000-04-24'
    Severity: SER
    Status: Closed
    Submitter: pat
    ChangedBy: hobbs
    OS: Windows NT
    OSVersion: 4.0, service pack 3
    Machine: X86
    FixedDate: '2000-10-25'
    ClosedDate: '2000-04-24'
    
    
    Name:
    Fred Roeber
    
    Extensions:
    DP
    
    CustomShell:
    patch from Bug ID 893
    
    ReproducibleScript:
    The code we are using to receive data over a TCP socket follows.
    
    # set up a socket to handle upload requests (will call tscan_socket)
    if {[catch {socket -server tscan_socket $tscan_port} tscan_server_id]} {
        # command failed so signal receive disabled
        tscan_display "Error - couldn't connect socket: $tscan_server_id"
    }
    
    proc tscan_socket {chan_id ip_addr port} {
        global tscan_file_id
    
        if {[catch {open "dummy" "w"} tscan_file_id]} {
            # problem opening file
            tscan_display "Error - couldn't open file: $tscan_file_id"
            close $chan_id
            return
        }
        fconfigure $tscan_file_id -translation binary -blocking no
    
        # set up to receive the upload data
        fconfigure $chan_id -translation binary -blocking no
        fileevent $chan_id readable "tscan_socket_read $chan_id $tscan_file_id"
    }
    
    proc tscan_socket_read {chan_id file_id} {
        if {[catch {read $chan_id} data]} {
            tscan_display "problem reading TimeScan data from socket"
        } elseif {[eof $chan_id]} {
            tscan_display "Done"
        } elseif {[catch {puts -nonewline $file_id $data} file_err]} {
            tscan_display "Error writing TimeScan data to file: $file_err"
        } else {
            # everything worked so we are done. Do a display update so that program
            # isn't unresponsive
            update
            return
        }
    
        # we had some problem so shut down channel
        catch {close $chan_id}
        catch {close $file_id}
    }
    
    
    
    
    ObservedBehavior:
    This code above works fine under Solaris. Under windows, we receive an
    extra '0' byte (not '\0') from the socket connection that gets written to the
    output file. If the system sending the data just opens a closes a TCP
    connection, we get a 0 byte file on Solaris but a 1 byte file under
    Windows/NT 4.0.
    
    
    
    
    
    
    DesiredBehavior:
    I expect Solaris and windows to produce the same resultswith the code above.
    
    
    
    
    
    As a note of reference, I found the patch for bug ID 893 on your site. I
    installed it as it was required to have it installed to get asynchronous
    sockets to be properly opened under Windows.
    
    --
    I'm not able to reproduce this with 8.2.3 on NTsp4. 
    -- 04/19/2000 hobbs
    Response from user:
    
    Hello, I had found out the source of this problem after submitting the
    report. The issue was that the sending application was sending up an
    OOB (out of band) message with a '0' in it before closing the socket.
    The intent was the "wake up" the host so it could close the socket
    quickly. Windows doesn't support OOB messages on sockets so added the
    '0' to the output stream. I just chalked this up as one of those Unix
    vs Windows TCP/IP stack differences. Thanks for the response.  Fred
    
       |      Fred J Roeber,  BBN Systems & Technologies      |
     
    -- 04/24/2000 hobbs
    
  4. foundin changed to: "obsolete: 8.0.4"
  5. priority changed to: "5 Medium"
  6. resolution changed to: "None"
  7. status changed to: "Open"
  8. submitter changed to: "nobody"
  9. subsystem changed to: "63. (unused)"
  10. title changed to:
    Reading data from socket on Windows appends extra '0' value
    
  11. type changed to: "Bug"