From owner-freebsd-hackers Sun May 24 08:11:03 1998 Return-Path: Received: (from majordom@localhost) by hub.freebsd.org (8.8.8/8.8.8) id IAA28733 for freebsd-hackers-outgoing; Sun, 24 May 1998 08:11:03 -0700 (PDT) (envelope-from owner-freebsd-hackers@FreeBSD.ORG) Received: from relay.ucb.crimea.ua (relay.ucb.crimea.ua [194.93.177.113]) by hub.freebsd.org (8.8.8/8.8.8) with ESMTP id IAA28704 for ; Sun, 24 May 1998 08:10:30 -0700 (PDT) (envelope-from ru@ucb.crimea.ua) Received: (from ru@localhost) by relay.ucb.crimea.ua (8.8.8/8.8.8) id SAA10051; Sun, 24 May 1998 18:10:25 +0300 (EEST) (envelope-from ru) Message-ID: <19980524181025.A10039@ucb.crimea.ua> Date: Sun, 24 May 1998 18:10:25 +0300 From: Ruslan Ermilov To: Mara Cabrales , hackers@FreeBSD.ORG Subject: Re: Program with sockets Mail-Followup-To: Mara Cabrales , hackers@FreeBSD.ORG References: Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Mailer: Mutt 0.91i In-Reply-To: ; from Mara Cabrales on Sun, May 24, 1998 at 04:37:10AM -0400 X-Operating-System: FreeBSD 2.2.6-STABLE i386 Sender: owner-freebsd-hackers@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG On Sun, May 24, 1998 at 04:37:10AM -0400, Mara Cabrales wrote: > Hi > > I'm doing a program with sockets in my box with FreeBSD 2.2.5, > the server run good, but the client, show next error message: > > Client: connect failure 49 > client: : No such file or directory > > I don't know that is wrong ... > > #define SERV_TCP_PORT 4000 > #define SERV_HOST_ADDR "127.0.0.1" > ... > sockfd = socket ( AF_INET , SOCK_STREAM, 0 ); > ... > bzero ((char *) &serv_addr, sizeof (serv_addr)); > serv_addr.sin_family = AF_INET ; > serv_addr.sin_addr.s_addr = inet_addr(SERV_HOST_ADDR ) ; > serv_addr.sin_port = htonl (SERV_TCP_PORT) ; Change htonl() -> htons() > > if (connect(sockfd,(struct sockaddr *)&serv_addr,sizeof(serv_addr))<0){ > printf("Client: connect failure %d\n", errno); > perror("client: "); > exit(1); > } > ... -- Ruslan Ermilov System Administrator ru@ucb.crimea.ua United Commercial Bank +380-652-247647 Simferopol, Crimea 2426679 ICQ Network, UIN To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-hackers" in the body of the message