Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Posting-Version: version B 2.10.2 9/18/84; site marlin.UUCP Path: utzoo!watmath!clyde!bonnie!akgua!sdcsvax!noscvax!marlin!sloane From: sloane@marlin.UUCP Newsgroups: net.unix-wizards Subject: Help: 4.2bsd IPC routines/TCP sequence error? Message-ID: <601@marlin.UUCP> Date: Thu, 14-Mar-85 13:39:58 EST Article-I.D.: marlin.601 Posted: Thu Mar 14 13:39:58 1985 Date-Received: Sat, 16-Mar-85 01:47:04 EST Distribution: net Organization: Naval Ocean Systems Center, San Diego Lines: 98 OVERVIEW: I am working on a series of programs that communicate via TCP over a 10mb ethernet. The hosts are all Vaxen (750s and 780s) all running 4.2bsd. The application is written in C and uses the calls outlined in the 4.2bsd Interprocess Communications Primer. Our problem is that when we send records from one host to another, the order in which they are received is not the same as the order they were sent. The problem seems to be in the timing between repeated calls to send(). SPECIFICS: Here is a sample of the code used to send and recieve info over the TCP socket: the lines marked /* CROWBAR */ in SEND are necessary to make it work. We think this is because of a timing problem in the send and/or recv loops. The socket is opened AF_INET/SOCK_STREAM. There is NO select() call made as there is only one socket open. The TCP address is sent from the host requesting the transfer via UDP (it works great). The sample code opens a file on one host and uses the send() call to transfer it over a TCP socket to another host. The file is transferred line-by-line. The file consists of 64 records with sequence numbers from 0-63. We know the data is not received in order because there is a test in the RECV code to make sure that the received sequence number is the same as the loop counter. Without the CROWBAR code these fragments transfer portions of the file (like maybe the 1st 14 records) and then trap at the "out of sequence" error in RECV. The amount of data transferred varies from try to try... With the CROWBAR code the entire transfer works fine (all 64 records are transferred IN ORDER). ---------------------- SEND ------------------------------------- /* open memo group file */ fd = fopen("memogrp.fil","r"); /* read memogroup records and send via TCP */ for(cnt=0; cnt