Path: news.net.uni-c.dk!noatun.mjolner.dk!mail-to-news From: Morten Grouleff Newsgroups: comp.lang.beta Subject: Re: Process library: inetAddr -> AAA.BBB.CCC.DDD Date: 21 Mar 2002 10:40:44 +0100 Organization: Posted to comp.lang.beta by a mailtonews script Lines: 36 Sender: lbr@mjolner.dk Approved: mailtonews@cs.au.dk Message-ID: References: <001c01c1d0a0$e8682a50$6501a8c0@server> NNTP-Posting-Host: noatun.mjolner.dk Mime-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: 8bit X-Trace: news.net.uni-c.dk 1016728309 15322 130.225.4.242 (21 Mar 2002 16:31:49 GMT) X-Complaints-To: usenet@news.net.uni-c.dk NNTP-Posting-Date: Thu, 21 Mar 2002 16:31:49 +0000 (UTC) Mailing-List: contact usergroup-help@mjolner.dk; run by ezmlm X-No-Archive: yes In-Reply-To: "Sascha Kimmel"'s message of "Thu, 21 Mar 2002 07:23:25 +0100" User-Agent: Gnus/5.0803 (Gnus v5.8.3) Emacs/20.5 X-Original-Message-ID: X-Original-Sender: mg@hod.mjolner.dk Xref: news.net.uni-c.dk comp.lang.beta:13171 "Sascha Kimmel" writes: > I would like to get the IP address in my BETA program in the form of > AAA.BBB.CCC.DDD, but inetAddr returns this as an integer value. > Is there a built-in function allowing me to convert that value or do you > have a ready-to-use function that you might want to share with the world? :) I'm not 100% sure what you want to accomplish. If you want to connect a socket to a process of a machine of which you known the address in that format, just put the address, e.g. 130.225.4.242 into the 'host' part as if it was the name of the host. If you want to display an address in the dotted format, then you'll probably have to write that on your own. Or use the one I have provided below. ORIGIN '~beta/basiclib/formatio'; INCLUDE '~beta/process/private/socketsint'; --PROGRAM: descriptor-- (# inetaddr: @Integer; do initSockets; 'www.mjolner.com' -> host2inetAddr -> inetaddr; '%i.%i.%i.%i'->screen.putFormat (# do (inetaddr %srl 24) %Band 255 -> i; (inetaddr %srl 16) %Band 255 -> i; (inetaddr %srl 8) %Band 255 -> i; inetaddr %Band 255 -> i; #); #) Regards, -- Morten Grouleff, M.Sc. C.S., Software Developer, Mjølner Informatics A/S. Phone: +45 70274343 Direct: +45 89425815 Fax: +45 70274344