Jump to content
  • Advertisement

Archived

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

Zoomby

changing ip header (TTL) with winsock

This topic is 5589 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

hi, is is possible to change the "time to live" value in a packet without needing to use raw sockets? bye chris

Share this post


Link to post
Share on other sites
Advertisement
Just check the setsockopt() documentation. It is all written there.

The definition is:

int setsockopt (int sd, int level, int optname, const void *optval, socklen_t optlen);

sd - socket descriptor
level - the level of the parameter you want to set
optname - the parameter you want to set
optval - the pointer to the parameter value
optlen - the length of the parameter you want to set

In your case it should be:

int value = 128; //this should be something you want to set for TTL
setsockopt (sd, SOL_IP, IP_TTL, &value, sizeof(value));

By the way, there are plenty of other parameters you can set to control your socket... =)

[edited by - x33 on March 3, 2003 8:14:08 PM]

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!