changing ip header (TTL) with winsock
hi,
is is possible to change the "time to live" value in a packet without needing to use raw sockets?
bye
chris
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]
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]
"I'll be Bach!" (c) Johann Sebastian Schwarzenegger
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement
Recommended Tutorials
Advertisement