From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: mark@markwitmer.com Newsgroups: gmane.lisp.guile.user Subject: Re: Trouble w/sockets Date: Sun, 03 Mar 2013 00:36:09 -0500 Message-ID: <87wqtp11va.fsf@markwitmer.com> References: <871ubxxie3.fsf@markwitmer.com> <1362286125.99740.YahooMailNeo@web120403.mail.ne1.yahoo.com> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Trace: ger.gmane.org 1362288972 14217 80.91.229.3 (3 Mar 2013 05:36:12 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Sun, 3 Mar 2013 05:36:12 +0000 (UTC) Cc: guile-user@gnu.org To: Mike Gran Original-X-From: guile-user-bounces+guile-user=m.gmane.org@gnu.org Sun Mar 03 06:36:36 2013 Return-path: Envelope-to: guile-user@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1UC1b9-0005Ud-Iz for guile-user@m.gmane.org; Sun, 03 Mar 2013 06:36:35 +0100 Original-Received: from localhost ([::1]:37910 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UC1ao-00026K-86 for guile-user@m.gmane.org; Sun, 03 Mar 2013 00:36:14 -0500 Original-Received: from eggs.gnu.org ([208.118.235.92]:47730) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UC1af-00026A-VK for guile-user@gnu.org; Sun, 03 Mar 2013 00:36:06 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1UC1ae-0000ig-PI for guile-user@gnu.org; Sun, 03 Mar 2013 00:36:05 -0500 Original-Received: from mail-ie0-x236.google.com ([2607:f8b0:4001:c03::236]:64748) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UC1ae-0000ia-LS for guile-user@gnu.org; Sun, 03 Mar 2013 00:36:04 -0500 Original-Received: by mail-ie0-f182.google.com with SMTP id k14so5051465iea.13 for ; Sat, 02 Mar 2013 21:36:03 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=x-received:from:to:cc:subject:references:date:in-reply-to :message-id:user-agent:mime-version:content-type :content-transfer-encoding:x-gm-message-state; bh=ZjngzUXmtyvuE01YwP6+SadGqbdm0Y3rv2luxcMv9BM=; b=l/hyPra1Xpwrf3426TAJ6H797AN0ydqHW1ZJ4IKn2MCGKIRA4lOjYUeFLsQhOwfn16 jCv+IcmCvtcFcKEWorU8bgWxqgIaYmRBdxMRuxVJXMXo/xZdvValYSP8lrAPKn6xc6v5 ZP7XUn4zshJ2W60fq0YwjseKdKxxIiwKtmC8WY6d+6g5OLq7AI2KHbzLRHOUdtJVyVXH Fx7nV2ScKcy2KK9Lc/TVkz8HMKYUAHQu/VXWn+cnsy7o83G0Tt38RklsWmONFZOoimtU UkqxnOXy7wbCtcJHgZXT2v2/VbSw9pltcI/fZOtak0m6V/UUFQEmSZJVK0k/wM93cWwp +3Ig== X-Received: by 10.42.92.72 with SMTP id s8mr19477185icm.0.1362288963539; Sat, 02 Mar 2013 21:36:03 -0800 (PST) Original-Received: from localhost (cpe-184-58-115-186.woh.res.rr.com. [184.58.115.186]) by mx.google.com with ESMTPS id s8sm5656090igs.0.2013.03.02.21.36.02 (version=TLSv1.2 cipher=RC4-SHA bits=128/128); Sat, 02 Mar 2013 21:36:02 -0800 (PST) In-Reply-To: <1362286125.99740.YahooMailNeo@web120403.mail.ne1.yahoo.com> (Mike Gran's message of "Sat, 2 Mar 2013 20:48:45 -0800 (PST)") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.2 (gnu/linux) X-Gm-Message-State: ALoCoQktqzIWLBg5yxlHiyLYuq1VMloua3ufz5CXJJCAH4tNQF+a7LcPGzzdQedRwrE+0PZEHOHA X-detected-operating-system: by eggs.gnu.org: Error: Malformed IPv6 address (bad octet value). X-Received-From: 2607:f8b0:4001:c03::236 X-BeenThere: guile-user@gnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: General Guile related discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guile-user-bounces+guile-user=m.gmane.org@gnu.org Original-Sender: guile-user-bounces+guile-user=m.gmane.org@gnu.org Xref: news.gmane.org gmane.lisp.guile.user:10161 Archived-At: Mike Gran writes: > > Crash? Or throw an error?=C2=A0 I definitely shouldn't crash, but, I coul= d see > how it could throw an error on Guile 2.0. Sadly, it does crash. No error message at all, so it's probably a segfault or something of that kind. > The problem with `write-char' in Guile 2.0 is that it does all the > conversion to the current locale.=C2=A0 So, once you start hitting the by= tes > greater than 127 in your string, `write-char' tries to convert each > byte to something in your encoding. > > If your encoding is "C" or anything that strictly uses ASCII as its > character encoding, it'll throw an error when its trying to print any > byte above 127.=C2=A0 If your encoding is UTF-8, those high bytes will be= come > two byte strings. > > Ideally you'd be able to use bytevectors or binary ports or some such. Binary ports are nice to work with; the trouble I have is that in the end it's still my job to write the "read" and "write!" functions that interface with the underlying port, and there's no guarantee that I'll do that right. Still, it confines a lot of potential problems to one or two places. > But you can also fake it by setting the port encoding to ISO-8859-1. > In that encoding the characters 0 to 255 map one-to-one with the bytes > from 0 to 255. > (set-port-encoding! sock "ISO-8859-1") That's a good point! Unfortunately the code I provided before still crashes even if I add that line before doing any reading from the port. I tried adding buffering to the port, and now when I attempt to read from it after writing the message and flushing it, I get an error that the "resource is temporarily unavailable." Perhaps there's something I need to do before connecting to the X server to ensure that it doesn't hang up on me. Time to go look at the xcb C source code again... > Hope this helps, Thanks, I think it will, despite my apparent frustration. These encoding issues were likely to crop up later even if they aren't the cause of my current troubles. --=20 Mark Witmer