From owner-freebsd-hackers Sun May 24 07:44:44 1998 Return-Path: Received: (from majordom@localhost) by hub.freebsd.org (8.8.8/8.8.8) id HAA25128 for freebsd-hackers-outgoing; Sun, 24 May 1998 07:44:44 -0700 (PDT) (envelope-from owner-freebsd-hackers@FreeBSD.ORG) Received: from kremvax.demos.su (kremvax.demos.su [194.87.0.20]) by hub.freebsd.org (8.8.8/8.8.8) with SMTP id HAA25111 for ; Sun, 24 May 1998 07:44:30 -0700 (PDT) (envelope-from sinbin.demos.su!bag@kremvax.demos.su) Received: by kremvax.demos.su (8.6.13/D) from 0@sinbin.demos.su [194.87.5.31] with ESMTP id SAA28266; Sun, 24 May 1998 18:44:17 +0400 Received: by sinbin.demos.su id SAA28909; (8.6.12/D) Sun, 24 May 1998 18:44:15 +0400 From: bag@sinbin.demos.su (Alex G. Bulushev) Message-Id: <199805241444.SAA28909@sinbin.demos.su> Subject: Re: Program with sockets In-Reply-To: from "Mara Cabrales" at "May 24, 98 04:37:10 am" X-ELM-OSV: (Our standard violations) no-mime=1; no-hdr-encoding=1 To: yonny@ingenieria.ingsala.unal.edu.co (Mara Cabrales) Date: Sun, 24 May 1998 18:44:15 +0400 (MSD) Cc: hackers@FreeBSD.ORG X-Mailer: ELM [version 2.4ME+ PL32 (25)] Content-Type: text Sender: owner-freebsd-hackers@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG > 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 ); ^^^^^^^ PF_INET ^ IPPROTO_TCP (this is not error :) > ... > 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) ; ^^^^^ use htons() Alex. > > if (connect(sockfd,(struct sockaddr *)&serv_addr,sizeof(serv_addr))<0){ > printf("Client: connect failure %d\n", errno); > perror("client: "); > exit(1); > } > ... > Thanks for your help > > ------------------------------------------------------------------------- > YONNY CARDENAS B. > || || ||| || > Universidad Nacional de Colombia || || || | || > Email : yonny@ingenieria.ingsala.unal.edu.co ||||||| || ||| > > > To Unsubscribe: send mail to majordomo@FreeBSD.org > with "unsubscribe freebsd-hackers" in the body of the message > To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-hackers" in the body of the message