From owner-freebsd-net@FreeBSD.ORG Tue Apr 6 17:41:50 2010 Return-Path: Delivered-To: freebsd-net@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 77FE3106566C for ; Tue, 6 Apr 2010 17:41:50 +0000 (UTC) (envelope-from cswiger@mac.com) Received: from asmtpout025.mac.com (asmtpout025.mac.com [17.148.16.100]) by mx1.freebsd.org (Postfix) with ESMTP id 63F638FC13 for ; Tue, 6 Apr 2010 17:41:50 +0000 (UTC) MIME-version: 1.0 Content-transfer-encoding: 7BIT Content-type: text/plain; charset=us-ascii Received: from cswiger1.apple.com ([17.209.4.71]) by asmtp025.mac.com (Sun Java(tm) System Messaging Server 6.3-8.01 (built Dec 16 2008; 32bit)) with ESMTPSA id <0L0G002PPUHJXY40@asmtp025.mac.com> for freebsd-net@freebsd.org; Tue, 06 Apr 2010 10:41:44 -0700 (PDT) X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 spamscore=0 ipscore=0 phishscore=0 bulkscore=0 adultscore=0 classifier=spam adjust=0 reason=mlx engine=5.0.0-0908210000 definitions=main-1004060171 From: Chuck Swiger In-reply-to: Date: Tue, 06 Apr 2010 10:41:43 -0700 Message-id: <7FBEC12F-B609-4413-878E-DC5434A02572@mac.com> References: To: serena zanetta X-Mailer: Apple Mail (2.1078) Cc: freebsd-net@freebsd.org Subject: Re: Send "connect" control message X-BeenThere: freebsd-net@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Networking and TCP/IP with FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 06 Apr 2010 17:41:50 -0000 Hi-- On Apr 6, 2010, at 8:32 AM, serena zanetta wrote: > But first of all, I don't know how I can convert the IP_REMOTE, which is > currently IP_REMOTE = "10.0.0.90", into a in_addr structure... To convert a string to an IP address kept as an in_addr, you want inet_aton(), used like so: const char *ipstr = "127.0.0.1"; struct in_addr ip; if (!inet_aton(ipstr, &ip)) errx(1, "can't parse IP address %s", ipstr); [ Example borrowed from "man gethostbyaddr" ] Regards, -- -Chuck