Jump to content
  • Advertisement

Archived

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

Xtremehobo

Winsock is evil.

This topic is 5279 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

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
Advertisement
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

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!