gforth
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [gforth] socket.fs getting started problem


From: kibler
Subject: Re: [gforth] socket.fs getting started problem
Date: Tue, 17 Apr 2012 14:57:13 -0700
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:10.0.3) Gecko/20120329 Icedove/10.0.3

Thanks - removing the ~/.gforth cleared it all up.
Good thing I asked, as would have taken a very long time
to figure out that libraries might be in ~/.gforth.
I did a find on the ~/.gforth dir and saw way too
many libraries, and thus I am wondering how
many of my other tests were messed up by it
being there.

Thanks again!
Bill.

For others - what I saw in my .gforth dir...
/home/kibler/.gforth
/home/kibler/.gforth/libcc-named
/home/kibler/.gforth/libcc-named/socket.la
/home/kibler/.gforth/libcc-named/socket.lo
/home/kibler/.gforth/libcc-named/socket.c
/home/kibler/.gforth/libcc-named/syscalls386.la
/home/kibler/.gforth/libcc-named/fflib.c
/home/kibler/.gforth/libcc-named/syscalls386.c
/home/kibler/.gforth/libcc-named/syscalls386.lo
/home/kibler/.gforth/libcc-named/socket.o
/home/kibler/.gforth/libcc-named/syscalls386.o
/home/kibler/.gforth/libcc-named/.libs
/home/kibler/.gforth/libcc-named/.libs/socket.la
/home/kibler/.gforth/libcc-named/.libs/socket.so.0
/home/kibler/.gforth/libcc-named/.libs/syscalls386.so.0
/home/kibler/.gforth/libcc-named/.libs/syscalls386.la
/home/kibler/.gforth/libcc-named/.libs/syscalls386.so
/home/kibler/.gforth/libcc-named/.libs/socket.a
/home/kibler/.gforth/libcc-named/.libs/socket.lai
/home/kibler/.gforth/libcc-named/.libs/socket.o
/home/kibler/.gforth/libcc-named/.libs/socket.so
/home/kibler/.gforth/libcc-named/.libs/syscalls386.o
/home/kibler/.gforth/libcc-named/.libs/syscalls386.so.0.0.0
/home/kibler/.gforth/libcc-named/.libs/socket.so.0.0.0
/home/kibler/.gforth/libcc-named/.libs/syscalls386.lai
/home/kibler/.gforth/libcc-named/.libs/syscalls386.a


On 04/17/12 14:27, Bernd Paysan wrote:
Am Dienstag, 17. April 2012, 10:25:13 schrieb kibler:
The version of gforth I am using:
  >  gforth

Gforth 0.7.9-20120317, Copyright (C) 1995-2011 Free Software Foundation,
Inc.

The test code based on repost.fs to just open a socket for reading:

\ test.fs - test to see if can open a socket...
require unix/socket.fs

2000 constant nntp

1024 constant status-buf-len
create status-buf status-buf-len 2 + chars allot

: read-status { sock -- ior }

      sock stdout = if \ for debugging
          0 exit endif
      status-buf status-buf-len sock read-line throw 0= -39 and throw { len }
status-buf c@ [char] 1 [char] 3 1+ within if
          status-buf len type cr
          0
      else
          status-buf len type cr
          -21 \ unsupported operation
      endif ;

: repostx

      s" 127.0.0.1 " 2000 open-socket sock !
      ;
This fails to compile, since sock is not defined.

: repost

      parse-name { d: server }
      server nntp open-socket { sock }
      sock read-status throw
\    s" AUTHINFO USER " sock write-file throw user sock write-line throw
      sock read-status throw
\    s" AUTHINFO PASS " sock write-file throw passwd sock write-line throw
      sock read-status throw
\    start-id articles start-articles sock process-articles
\    s" QUIT" sock write-line throw
      sock read-status throw
      sock close-file throw ;

A couple of tests and their results:
Ok, here's my test and my result:

Running "nc -l 2000" on one terminal, and gforth test.fs on another terminal:

repost localhost 123
234
345
123
  ok

The numbers here are what I entered (should all start with 1 to 3).

Honestly, I have absolutely no clue at all what fails so horribly on your
system, because unix/socket.fs is something I use daily, and get-info is
certainly required, especially applied to localhost.

There is nothing wrong with your way of using open-socket and friends.

What could be possilbe is that you have an old socket.so.* in your
~/.gforth/libcc-named/.libs, which is not compatible with the new pthread-
enabled engine.  But then, a proper make install will install you a
socket.so.* for the new engine, and it won't look up ~/.gforth/libcc-
named/.libs.  Just in case, remove ~/.gforth, and try again.





reply via email to

[Prev in Thread] Current Thread [Next in Thread]