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

changing ip header (TTL) with winsock

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

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