C/C++ client server bind [closed]

asked 2016-07-11 04:06:29 -0500

kauv gravatar image

Hi,

I've successfully added openCV to my project and i wanted to implement client-server system. The socket function doesn't throw an error but the bind method does

if(bind(sockfd, (struct sockaddr *) &serv_addr, sizeof(serv_addr))<0)

stating "invalid operands to binary expression "__bind<int &amp;,sockaddr="" *,unsigned="" long="">' and 'int'".

I found the bind function is not the same.There seems to be another bind function when i added the openCV library which seems to be overlapping.Can someone please help me with this issue?

Thank you

edit retag flag offensive reopen merge delete

Closed for the following reason the question is answered, right answer was accepted by kauv
close date 2016-07-11 04:47:31.925189

Comments

my 1st guess: this is std::bind

so try either to use ::bind or avoid using namespace std;

berak gravatar imageberak ( 2016-07-11 04:10:33 -0500 )edit

yes ::bind worked.I don't understand why bind didn't work in the first place.Anyways thank you :)

kauv gravatar imagekauv ( 2016-07-11 04:31:40 -0500 )edit

if you use plain bind , it's unclear to your compiler if it should use the socket function, or the one from <functional> . explicitly using ::bind resolves it.

also please don't forget to close your github issue ;)

berak gravatar imageberak ( 2016-07-11 04:45:42 -0500 )edit