From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Mike Gran Newsgroups: gmane.lisp.guile.user Subject: Re: Trouble w/sockets Date: Sat, 2 Mar 2013 20:48:45 -0800 (PST) Message-ID: <1362286125.99740.YahooMailNeo@web120403.mail.ne1.yahoo.com> References: <871ubxxie3.fsf@markwitmer.com> Reply-To: Mike Gran NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: quoted-printable X-Trace: ger.gmane.org 1362286135 28201 80.91.229.3 (3 Mar 2013 04:48:55 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Sun, 3 Mar 2013 04:48:55 +0000 (UTC) To: "mark@markwitmer.com" , "guile-user@gnu.org" Original-X-From: guile-user-bounces+guile-user=m.gmane.org@gnu.org Sun Mar 03 05:49:19 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 1UC0rO-0007Dd-R6 for guile-user@m.gmane.org; Sun, 03 Mar 2013 05:49:19 +0100 Original-Received: from localhost ([::1]:33136 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UC0r3-0002Vu-Ic for guile-user@m.gmane.org; Sat, 02 Mar 2013 23:48:57 -0500 Original-Received: from eggs.gnu.org ([208.118.235.92]:42319) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UC0qv-0002Vd-5H for guile-user@gnu.org; Sat, 02 Mar 2013 23:48:50 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1UC0qt-0004pS-Mx for guile-user@gnu.org; Sat, 02 Mar 2013 23:48:49 -0500 Original-Received: from nm22-vm0.bullet.mail.ne1.yahoo.com ([98.138.91.60]:21731) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UC0qt-0004pN-CQ for guile-user@gnu.org; Sat, 02 Mar 2013 23:48:47 -0500 Original-Received: from [98.138.90.55] by nm22.bullet.mail.ne1.yahoo.com with NNFMP; 03 Mar 2013 04:48:45 -0000 Original-Received: from [98.138.89.248] by tm8.bullet.mail.ne1.yahoo.com with NNFMP; 03 Mar 2013 04:48:45 -0000 Original-Received: from [127.0.0.1] by omp1040.mail.ne1.yahoo.com with NNFMP; 03 Mar 2013 04:48:45 -0000 X-Yahoo-Newman-Property: ymail-3 X-Yahoo-Newman-Id: 908993.59363.bm@omp1040.mail.ne1.yahoo.com Original-Received: (qmail 99924 invoked by uid 60001); 3 Mar 2013 04:48:45 -0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yahoo.com; s=s1024; t=1362286125; bh=GQwtBkpYU3l9GJgj1UsVEtY8rG17+ZPKdSqvxs5Jn4I=; h=X-YMail-OSG:Received:X-Rocket-MIMEInfo:X-Mailer:References:Message-ID:Date:From:Reply-To:Subject:To:In-Reply-To:MIME-Version:Content-Type:Content-Transfer-Encoding; b=noUdQCV6NxslzpEDPV48eWbwNGK9powPwn+zXJumIX3gyMrep0LaOEawwLhTt6q053/D7qbvE/kdA87zlRY7V5mpbYtNAlbTunO88njLeYPpfMHJp9jte5nn+lEBv4lp4nXYbRDBQlF1vJFLB2km346PD8ZGT0KVkwBSHUbTTQA= DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=s1024; d=yahoo.com; h=X-YMail-OSG:Received:X-Rocket-MIMEInfo:X-Mailer:References:Message-ID:Date:From:Reply-To:Subject:To:In-Reply-To:MIME-Version:Content-Type:Content-Transfer-Encoding; b=1vOn2TdE1AyJLdFjxjmj9i0zwgps0sOCxCUbC5Pup/v0T4xSZ9g8RSPtMEziK5ayrkviPqxkYU+tm+pr2dbrQRfIF0Z6cOHbfyZGRgpVWZCoMpq5du5h3GSr+/LN3oejlfiBACuqxtHIwqtKQzyxU8rTRg13hucTB87CIylHBHE=; X-YMail-OSG: GZuvFJEVM1mPHqgfnZPcnNNPxt81w8XQYP.AVbyLoLWBP9H fbYtGaS9rhTmmeGC5scfLjRUhG9tT1B9UO4JIBostZe387_6RUpLm9GVWD5T WAV0kMDwqg5yYVZzE5P36_NyuNxAK.Q2v.NfTcAL2gYFGpAMIIwN7_1ag29f JGMb5A_.766S8bsOO2NwkwntzwN3memTPw8Ds.VKplshDEnsN5Ibbyof1Zlt 5qF2EXqcBuxGKKxzfXNftEAYYoWDL8lZhWOHKhq81hHGQ9kyCVXb9Y6miA5a 0k.EEGeI0Ih5EIcxpIKUrog3FNR.OMQuH1.EbGtAieTJ.fwP1nQcYUcRhB1O HB.nX6X4X5YKVoib8wrhES2Ch0U3zSVCbdVBVR2dJwMozqdf9nv_gts6ae.e lQiFlGE9CU4TsuW9fSL7x_N3YJijLmlQa0cFSiHd7MJOSVEMhWc2293ixzXN Mxr_Ieis5NRCpHam4whWbdxHFkNgXYXHZTAPesNK21l4vmkuy4CTK8TfcT5v Iw7UpRHFhYVF9gtOrBWI- Original-Received: from [71.130.217.119] by web120403.mail.ne1.yahoo.com via HTTP; Sat, 02 Mar 2013 20:48:45 PST X-Rocket-MIMEInfo: 001.001, PiBGcm9tOiAibWFya0BtYXJrd2l0bWVyLmNvbSIgPG1hcmtAbWFya3dpdG1lci5jb20.Cgo.IChmb3ItZWFjaMKgIMKgIMKgIAo.IMKgIChsYW1iZGEgKGIpCj4gwqAgwqAgKHdyaXRlLWNoYXIgKGludGVnZXItPmNoYXIgYikgc29jaykpCj4gwqAgwqAgwqAgJygxMDggMCAxMSAwIDAgMCAxOCAwIDE2IDAgMCAwIDc3IDczIDg0IDQ1IDc3IDY1IDcxIDczIDY3IDQ1IDY3IDc5Cj4gwqAgwqAgwqAgNzkgNzUgNzMgNjkgNDUgNDkgMCAwIDAgMCAwIDAgMCAwIDAgMCAwIDAgMCAwIDAgMCAwIDAgMjQzIDIzNiA1NgoBMAEBAQE- X-Mailer: YahooMailWebService/0.8.135.514 In-Reply-To: <871ubxxie3.fsf@markwitmer.com> X-detected-operating-system: by eggs.gnu.org: FreeBSD 8.x X-Received-From: 98.138.91.60 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:10160 Archived-At: > From: "mark@markwitmer.com" =0A=0A> (for-each=A0 =A0= =A0 =0A> =A0 (lambda (b)=0A> =A0 =A0 (write-char (integer->char b) sock))= =0A> =A0 =A0 =A0 '(108 0 11 0 0 0 18 0 16 0 0 0 77 73 84 45 77 65 71 73 67 = 45 67 79=0A> =A0 =A0 =A0 79 75 73 69 45 49 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 = 0 0 243 236 56=0A> =A0 =A0 =A0 103 158 249 237 124 101 131 158 31 63 251 23= 9 7 0 0 0 0 0 0 0 0 0=0A> =A0 =A0 =A0 0 0 0 0 0 0 0))=0A> =0A> This will ob= viously be the wrong authentication data for anyone else's X=0A> server; ho= wever, even if X closes the socket prematurely (not that it's=0A> supposed = to, but it might), Guile shouldn't just crash, should it?=0A=0ACrash? Or th= row an error?=A0 I definitely shouldn't crash, but, I could see=0Ahow it co= uld throw an error on Guile 2.0.=0A=0AThe problem with `write-char' in Guil= e 2.0 is that it does all the=0Aconversion to the current locale.=A0 So, on= ce you start hitting the bytes=0Agreater than 127 in your string, `write-ch= ar' tries to convert each=0Abyte to something in your encoding.=0A=0AIf you= r encoding is "C" or anything that strictly uses ASCII as its=0Acharacter e= ncoding, it'll throw an error when its trying to print any=0Abyte above 127= .=A0 If your encoding is UTF-8, those high bytes will become=0Atwo byte str= ings.=0A=0AIdeally you'd be able to use bytevectors or binary ports or some= such.=0A=0ABut you can also fake it by setting the port encoding to ISO-88= 59-1.=0AIn that encoding the characters 0 to 255 map one-to-one with the by= tes=0Afrom 0 to 255.=0A(set-port-encoding! sock "ISO-8859-1")=0A=0AHope thi= s helps,=0A=0AMike=0A