sockaddr_in target;
target.sin_family = AF_INET; // address family Internet
target.sin_port = htons (80); // set server’s port number
target.sin_addr.s_addr = inet_addr ("216.127.36.81"); // set server’s IP
connect(s, target, sizeof(target));
gives me:
:\vcpp\scancel\scancel.cpp(41) : error C2440: ''type cast'' : cannot convert from ''struct sockaddr_in'' to ''struct sockaddr *''
No user-defined-conversion operator available that can perform this conversion, or the operator cannot be called
Ideas?
Winsock is evil.
Well not really, but heres what''s happening.
connect(s, &target, sizeof(target));
Notice "&" in front of target.
You will probably have to type-cast it as well:
connect(s, (struct sockaddr*)&target, sizeof(target));
Notice "&" in front of target.
You will probably have to type-cast it as well:
connect(s, (struct sockaddr*)&target, sizeof(target));
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement