Problems using bind() in KDevelop

Simon Ejsing simon at esoft.dk
Mon Sep 2 14:11:55 BST 2002


	Yeah thanks, that helped... but I still can't set addr.sin_addr = INADDR_ANY; 
... that is how it's explained in the man pages, I'm a little confused :)

/Sharky

On Monday 02 September 2002 14:49, Israel Fernández wrote:
> You must add the & operator in the bind call
> bind(sock_fd,(struct sockaddr *) &addr,sizeof(addr));
>
> addr contains data and you can not convert all the struct in a sockaddr
> pointer, but you can convert the address of addr to a pointer. ;-)
>
> > <code snip from the cpp file of a KDE mini application>
> > #include <sys/socket.h>
> > #include <sys/types.h>
> > #include <netinet/in.h>
> > #include <arpa/inet.h>
> >
> > #include "socktest.h"
> >
> > Socktest::Socktest(QWidget *parent, const char *name) : QWidget(parent,
> > name) {
> > 	struct sockaddr_in		addr;
> >
> > 	addr.sin_family = AF_INET;
> > 	addr.sin_port = htons(0);
> > 	addr.sin_addr = INADDR_ANY;		// This is the line where the error
> > occurs.... sock_fd = socket(AF_INET,SOCK_STREAM,0);
> > 	bind(sock_fd,(struct sockaddr *) addr,sizeof(addr));
> > }
> > <snip end>
> >
> > Error message is:
> > socktest.cpp:31: no match for `in_addr & = in_addr_t'

-
to unsubscribe from this list send an email to kdevelop-request at kdevelop.org with the following body:
unsubscribe »your-email-address«



More information about the KDevelop mailing list