Jump to content
  • Advertisement

Archived

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

Null and Void

My UDP/IP Dilemma

This topic is 6356 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, I have my third TCP/IP wrapper class done, and I wanted to make myself a UDP/IP wrapper, and I''ve never done it before. So, I set about making it, and have it working for the most part. There''s only one problem, how do I find out if the person I just received a recvfrom data chunk from is the same person as someone I''ve already recorded? I.e. what peice of sockaddr is unique to a single person''s computer/IP Address/whatever? I realized that sockaddr.sa_family always seems to be two, and sockaddr.sa_data seems to be somewhat random, so I''m kind of lost. Thanks in advance for curing my UDP/IP ignorance . "Finger to spiritual emptiness underlying everything." -- How a C manual referred to a "pointer to void." --Things People Said
Resist Windows XP''s Invasive Production Activation Technology!
http://druidgames.cjb.net/

Share this post


Link to post
Share on other sites
Advertisement
For UDP cast the sockaddr structure to a sockaddr_in structure. You identify a particular user by his ip:port combo (sin_addr and sin_port).

Be sure to keep both the ip and the port. Some code just keeps the ip and breaks whenever you have multiple users on the same client box or when there''s a NAT around.

-Mike

Share this post


Link to post
Share on other sites
Yeah, I thought that''s what I was suppossed to do, but it says that it cannot cast sockaddr to sockaddr_in. So, I replaced all of the sockaddr''s with sockaddr_in''s, then casted it back to sockaddr in the correct places, and it just crashed...

I''m kind of lost at the moment...

"Finger to spiritual emptiness underlying everything." -- How a C manual referred to a "pointer to void." --Things People Said
Resist Windows XP''s Invasive Production Activation Technology!
http://druidgames.cjb.net/

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.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!