From owner-freebsd-hackers Wed Nov 20 18:39:52 1996 Return-Path: owner-hackers Received: (from root@localhost) by freefall.freebsd.org (8.7.5/8.7.3) id SAA28486 for hackers-outgoing; Wed, 20 Nov 1996 18:39:52 -0800 (PST) Received: from mail.crl.com (mail.crl.com [165.113.1.22]) by freefall.freebsd.org (8.7.5/8.7.3) with SMTP id SAA28471 for ; Wed, 20 Nov 1996 18:39:46 -0800 (PST) Received: from unix1.ism.com.br by mail.crl.com with SMTP id AA05510 (5.65c/IDA-1.5 for ); Wed, 20 Nov 1996 16:27:12 -0800 Received: from clpc1.compuland.com.br (clpc1.compuland.com.br [200.255.96.22]) by unix1.ism.com.br (8.7.1/8.7.1) with SMTP id WAA15690; Wed, 20 Nov 1996 22:26:01 -0200 Date: Wed, 20 Nov 1996 22:26:01 -0200 Message-Id: <199611210026.WAA15690@unix1.ism.com.br> X-Sender: compland@ism.com.br X-Mailer: Windows Eudora Version 1.4.4 Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" To: hackers@freebsd.org From: compland@ism.com.br (Helio Coelho Jr. - CompuLand Informatica) Subject: socket.h Cc: zyang01@fiu.edu Sender: owner-hackers@freebsd.org X-Loop: FreeBSD.org Precedence: bulk Hi: Sorry posting here. I'm not member of the developers group but I have a question that maybe someone from this list can help me ! The problem is that I'm tring to port an irc gateway to WWW, written by Zhong Yang in C. I'm stuck in the following: this is from /include/sys/socket.h struct sockaddr { u_char sa_len; /* total length */ u_char sa_family; /* address family */ char sa_data[14]; /* actually longer; address value */ this is from /include/netinet/in.h struct sockaddr_in { u_char sin_len; u_char sin_family; u_short sin_port; struct in_addr sin_addr; char sin_zero[8]; And here, the problem. That's actually part of the code of the gateway: struct sockaddr_in SocketInetAddr; ^^^^^^^^^^^ SocketInetAddr.sin_port = htons(Port); SocketDescriptor = socket(AF_INET, SOCK_STREAM, 6); if (SocketDescriptor < 0) { perror("socket"); return (-1); } if (connect(SocketDescriptor, ( char *) &SocketInetAddr, sizeof(SocketInetAddr)) < 0) ^^^^^^^^^^^^^^^^^^^^^^^^^ RETURN_SUCCESS=1; else RETURN_SUCCESS=0; The above call to CONNECT reports an error because the connect function expects, in the second field, the use of sockaddr. But in the program, the call is for sockaddr_in. I don't know if in AIX or hpux this structures are the same, but I know that it works there ! Anyone has an idea how can I change this piece of code to put it to work in FreeBSD ? Thanks a lot! Sorry for the off_topic question! Regards, Helio.