|
OpenBSD General Other questions regarding OpenBSD which do not fit in any of the categories below. |
|
Thread Tools | Display Modes |
|
|||
netinet/in.h in OpenBSD 4.4 i386 broken?
I'm trying to get socket programming to work, but it just won't do it. I've tried the same code on Linux and other *nix OSes, and it worked fine, but it just refuses to work on OpenBSD...
The faults occur within that header file. Let's take this *really* simple C code... Code:
#include <netinet/in.h> #include <stdio.h> #include <sys/socket.h> #define PORT 13 int main( void ) { int socket = socket( AF_INET, SOCK_STREAM, 0 ); struct sockaddr_in address; address.sin_family = AF_INET; address.sin_port = PORT; puts( "\nInitialization complete.\n" ); return 0; } I'm using GCC by the way. |
|
|||
I hardly believe that this compiles anywhere, for one..
Code:
#include <sys/types.h> #include <sys/socket.h> #include <netinet/in.h> #define PORT 13 int main( void ) { int sock = socket( AF_INET, SOCK_STREAM, 0 ); struct sockaddr_in address; address.sin_family = AF_INET; address.sin_port = PORT; puts( "\nInitialization complete.\n" ); return 0; } Helpful links: http://beej.us/guide/bgnet/ |
|
|||
Quote:
Quote:
Hmmm, this still won't compile... Code:
#include <netinet/in.h> #include <stdio.h> #include <sys/socket.h> #include <sys/types> #define PORT 13 int main( void ) { int sock = socket( AF_INET, SOCK_STREAM, 0 ); struct sockaddr_in address; address.sin_family = AF_INET; address.sin_port = PORT; puts( "\nInitialization complete.\n" ); return 0; } |
|
|||
Thanks a lot! That solved nearly all the issues I was having. Furthermore, I completely forgot that the ordering of the includes makes a difference, so thanks for reminding me
|
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
OpenBSD 4.6 i386 boot hangs with old gateway system - resolved | comet--berkeley | OpenBSD Installation and Upgrading | 6 | 22nd July 2011 08:15 AM |
openbsd 4.5 macppc radeon drive still broken | gosha | OpenBSD Installation and Upgrading | 13 | 28th June 2009 03:14 PM |
openbsd 4.3 e2fsprogs seems to be broken | gosha | OpenBSD Packages and Ports | 0 | 27th June 2009 03:18 AM |
WindowMaker 0.92.0p7 (OpenBSD 4.4/i386 Packages) configuration issue. | xixobrax | OpenBSD General | 1 | 3rd May 2009 04:04 PM |
OpenBSD 4.4/4.5 i386 installation on Dell Inspiron 6400 notebook. | xixobrax | OpenBSD Installation and Upgrading | 12 | 30th April 2009 04:34 AM |