|
|
|
|
||||||
| comp.protocols.tcp-ip TCP and IP network protocols. |
![]() |
|
|
LinkBack | Outils de la discussion |
|
|
#1 (permalink) |
|
Messages: n/a
Hébergeur: |
I AM NEW TO NETWORK PROGRAMMING SO PLEASE BEAR.
I USED INADDR_ANY TO ASSIGN IP TO MY LOCAL INTERFACE ON THE TRANSMITTING SIDE. HOWEVER WHEN I PRINT THE THE IP ADDRESS OF MY LOCAL INTERFACE IT OUTPUTS 0.WHY SO AND WHAT TO DO |
|
|
|
#2 (permalink) |
|
Messages: n/a
Hébergeur: |
In article <1143726232.408721.299030@i40g2000cwc.googlegroups .com>,
shourya2003@yahoo.co.in wrote: > I AM NEW TO NETWORK PROGRAMMING SO PLEASE BEAR. Are you also new to using a keyboard? Please don't type all capitals. It's harder for most people to read, and in online communications is considered like shouting. > > I USED INADDR_ANY TO ASSIGN IP TO MY LOCAL INTERFACE ON THE > TRANSMITTING SIDE. HOWEVER WHEN I PRINT THE THE IP ADDRESS OF MY LOCAL > INTERFACE IT OUTPUTS 0.WHY SO AND WHAT TO DO Please provide more details about what you're doing. If you look at the INADDR_ANY macro in the header file, you'll see that its value is 0. This is used as a placeholder, and the stack only fills it in with a real address when necessary. For instance, if you have a connected socket, you can use getsockaddr() to get its local address, and it should contain a real address. But if you use this on the socket that is being used to listen for incoming connections, it will always show 0. -- Barry Margolin, barmar@alum.mit.edu Arlington, MA *** PLEASE post questions in newsgroups, not directly to me *** *** PLEASE don't copy me on replies, I'll read them in the group *** |
|
![]() |
| Outils de la discussion | |
|
|