From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 10316 invoked by alias); 21 Jan 2014 06:35:15 -0000 Mailing-List: contact ecos-discuss-help@ecos.sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: ecos-discuss-owner@ecos.sourceware.org Received: (qmail 10301 invoked by uid 89); 21 Jan 2014 06:35:14 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=1.5 required=5.0 tests=BAYES_50,SPF_SOFTFAIL autolearn=no version=3.3.2 X-HELO: mail.ihostasp.net Received: from mail01.ihostasp.net (HELO mail.ihostasp.net) (209.190.184.121) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Tue, 21 Jan 2014 06:35:13 +0000 Received: from 75-163-184-149.clsp.qwest.net [75.163.184.149] by mail.ihostasp.net with SMTP; Tue, 21 Jan 2014 01:35:04 -0500 From: Michael Jones Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: quoted-printable Message-Id: <339C0166-75DA-47B6-B019-24F898B5324A@proclivis.com> Date: Tue, 21 Jan 2014 06:35:00 -0000 To: ecos discuss Mime-Version: 1.0 (Mac OS X Mail 6.6 \(1510\)) Subject: [ECOS] Advice on streams and bsd sockets X-SW-Source: 2014-01/txt/msg00018.txt.bz2 I am looking for some advice on using streams with sockets. I am using CYGP= KG_NET and taking the socket handle and creating a stream with fdopen().=20 A fwrite() eventually arrives in this code: static int=20 bsd_lseek(struct CYG_FILE_TAG *fp, off_t *pos, int whence) { return ESPIPE; } And this causes an error, but a second call to fwrite() works. It always ha= ppens when there is a fwrite() immediately after a fread(), as that trigger= s the seek. I am looking for advice on how to handle this problem. Of course I could not use streams, but I am working with lua 5.2.3 and it i= s based on streams, and don't want to modify it that much. I also can't tur= n off buffering, because lua relies on the ability to push bytes back into = the stream after reading them. Does anyone have a patch that works around the problem or know of some othe= r way to create a stream that does not rely on seek? In the case where I us= e it, there is no need for seek anyway. I am using the stream in place of s= tdin and stdout so that lua can interact with a telnet session. Mike -- Before posting, please read the FAQ: http://ecos.sourceware.org/fom/ecos and search the list archive: http://ecos.sourceware.org/ml/ecos-discuss