I'm new to network programming. And I skimmed a few pages of beej programming guide and found some useful info but couldn't clear one doubt. We use bind to associate a sockaddr_in structure with the socket descriptor so that the kernel can send data to the network adapter and thereby communicate right. So I noticed the symbolic name INADDR_ANY. I tried a pre-processing only option in my gcc compiler and found the IP to be hexadecimal value of 127.0.0.1 the loop back IP. I'm just wondering what if I assigned a random IP of my choice to the s_addr pointer in the sockaddr_in structure instead of assigning it to INADDR_ANY. Would that mean i'm spoofing my IP?
timetraveller1992
10
Newbie Poster
Recommended Answers
Jump to PostWhen a process wants to receive new incoming packets or connections, it should bind a socket to a local interface address using bind. Only one IP socket may be bound to any given local (address, port) pair. When INADDR_ANY is specified in the bind call, the socket will be bound …
All 2 Replies
Reply to this topic
Be a part of the DaniWeb community
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.