Archived

This topic is now archived and is closed to further replies.

Xtremehobo

Winsock is evil.

Recommended Posts

Well not really, but heres what''s happening.
	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?

Share this post


Link to post
Share on other sites
Guest Anonymous Poster
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));

Share this post


Link to post
Share on other sites