locked
local host ambiguity and other issues

    Question

  • I am kind of in the beginning of what I see is a long path to conquer .NET concepts, so excuse my naivite on many issues.

    I am trying to develop a project that would listen to some active TCP/UDP ports in my Win2K or WinSer2003 OS and forward the stream of datagrams into SQL database tables. A number of parts of this project are already in place. Now I am working on a listening part.

    Here I used a Dns.GetHostName() to get the local host name. It gave me a canonical name DDMNVT61 which is my computer's name. The IP address for this name was 10.1.10.176 which is the IP address of my Comcast broadband modem/router (10.1.10.1).

    When I am checking NetStat with Essential Net Tools, a downloaded application, I can see THREE different local IP addresses for TCP/UDP protocols: 10.1.10.176, 127.0.0.1, and 0.0.0.0

    My first question is: why is the difference? Are those IP addresses equivalent?

    I have a static IP address which does not seem to be attached to any of the processes although I entered it into the Comcast router.

    My second question is: shall I try to attach these InterNetwork processes to the static IP address or not?

    I defined an IPEndPoint for "yahoo.com" port 80 and serialized it. It gave me the following console output:

    IPEndPoint information:216.109.118.69:80
     Maximum allowed Port Address :65535
     Minimum allowed Port Address :0
     Address Family :InterNetwork
    Endpoint.Serialize() : InterNetwork:16:{0,80,216,109,118,69,0,0,0,0,0,0,0,0}
    Socket.Family : InterNetwork
    Socket.Size : 16

    What does it mean InterNetwork:16. The size of the array is 14, not 16? Is it the size of the socketAddress buffer?

    Thanks.

    Thursday, November 17, 2005 4:09 PM

Answers

  • Really these are not .NET concepts, these are Networking Concepts.
    Unfortunately a lot of people try to stumble on writing lower level networking applications without the background knowledge of the essentials. The issue seems to be the time it takes to research. I sincerely recommend that you pick up the
    "Windows 2003 tcp.ip protocols referece" book which is my favorite book of all time. This book - eventhough it says reference and is thick - and can be boring at times - gives you the low down on what is networking all about. In a span of 4 weeks I learnt more that what I could have leant by stumbling through.

    Ok Now on to your questions:
    1) 127.0.0.1, 10.1.x.x, 0.0.0.0 they are all different IP addreses and not interchangeable.
    2) Every machine has 127.0.0.1 which is a loop back address.
    3) 10.1.x.x is a private address that the router gave you, I would assume
    4) 0.0.0.0 is not a valid IP Address - it might used for some default routing algorithms meaning any address
    5) I don't understand
    The IP address for this name was 10.1.10.176 which is the IP address of my Comcast broadband modem/router (10.1.10.1).
    Are you saying that 10.1.10.1 is the IP Address of the router and 10.1.10.176 is the address the router gave to your machine [Note that routers also have DHCP capabilities that dole out IP Addresses to the connected machines]

    6) the static IP Address you have for your CONNECTION is the one that the router manages. The static IP Address is not given to the computers connected to the router. In other words, the COMCAST modem/router is acting like a NAT, the network address translator. The individual machines attached to that router will never see the static IP Address you were given by COMCAST

    7) Regarding seralization, you shouold not really worry about it as long as you are
    able to searlize the end point back.

    8) In general I advise you not to searlize the end point. there is no guarantee that yahoo.com will always be at that address. they can change that any time and update the dns servers.
    Thursday, November 17, 2005 5:31 PM

All replies

  • Really these are not .NET concepts, these are Networking Concepts.
    Unfortunately a lot of people try to stumble on writing lower level networking applications without the background knowledge of the essentials. The issue seems to be the time it takes to research. I sincerely recommend that you pick up the
    "Windows 2003 tcp.ip protocols referece" book which is my favorite book of all time. This book - eventhough it says reference and is thick - and can be boring at times - gives you the low down on what is networking all about. In a span of 4 weeks I learnt more that what I could have leant by stumbling through.

    Ok Now on to your questions:
    1) 127.0.0.1, 10.1.x.x, 0.0.0.0 they are all different IP addreses and not interchangeable.
    2) Every machine has 127.0.0.1 which is a loop back address.
    3) 10.1.x.x is a private address that the router gave you, I would assume
    4) 0.0.0.0 is not a valid IP Address - it might used for some default routing algorithms meaning any address
    5) I don't understand
    The IP address for this name was 10.1.10.176 which is the IP address of my Comcast broadband modem/router (10.1.10.1).
    Are you saying that 10.1.10.1 is the IP Address of the router and 10.1.10.176 is the address the router gave to your machine [Note that routers also have DHCP capabilities that dole out IP Addresses to the connected machines]

    6) the static IP Address you have for your CONNECTION is the one that the router manages. The static IP Address is not given to the computers connected to the router. In other words, the COMCAST modem/router is acting like a NAT, the network address translator. The individual machines attached to that router will never see the static IP Address you were given by COMCAST

    7) Regarding seralization, you shouold not really worry about it as long as you are
    able to searlize the end point back.

    8) In general I advise you not to searlize the end point. there is no guarantee that yahoo.com will always be at that address. they can change that any time and update the dns servers.
    Thursday, November 17, 2005 5:31 PM
  • I appreciate your answer very much including the book reference which I will acquire right away. I have been using "TCP/IP Sockets in C#" by D. Mafoske, M. Donahoo and K. Calvert. It helped me  navigate some issues.

    You interpreted my ambiguous point 5) correctly. The IP address for the router is 10.1.10.1 and the IP address (local DHCP gave to the machine (I have a small LAN in here) is apparetnly 10.1.10.176.

    Thank you very much.
    Thursday, November 17, 2005 5:48 PM