Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
CODE PROJECT For Those Who Code
  • Home
  • Articles
  • FAQ
Community
  1. Home
  2. General Programming
  3. Visual Basic
  4. Big Endian format and IP Address

Big Endian format and IP Address

Scheduled Pinned Locked Moved Visual Basic
tutorialquestion
5 Posts 3 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • D Offline
    D Offline
    ddspliting
    wrote on last edited by
    #1

    declaring a new IP address Dim add As IPAddress(New Address As Long) the long value of IP Address? how to find that? it says like a value 0x3l3443 in big endian format... how to convert IP to big endian or Long?

    C A 2 Replies Last reply
    0
    • D ddspliting

      declaring a new IP address Dim add As IPAddress(New Address As Long) the long value of IP Address? how to find that? it says like a value 0x3l3443 in big endian format... how to convert IP to big endian or Long?

      C Offline
      C Offline
      Christian Graus
      wrote on last edited by
      #2

      Just use shift operators to move your 4 bytes into the right locations of your single digit.

      Christian Graus No longer a Microsoft MVP, but still happy to answer your questions.

      D 1 Reply Last reply
      0
      • C Christian Graus

        Just use shift operators to move your 4 bytes into the right locations of your single digit.

        Christian Graus No longer a Microsoft MVP, but still happy to answer your questions.

        D Offline
        D Offline
        ddspliting
        wrote on last edited by
        #3

        didn't get that honestly! say i ve an IP 123.212.4.3 hot to find its long or big endian form?

        C 1 Reply Last reply
        0
        • D ddspliting

          didn't get that honestly! say i ve an IP 123.212.4.3 hot to find its long or big endian form?

          C Offline
          C Offline
          Christian Graus
          wrote on last edited by
          #4

          In C#, you'd do do 123 << 8 to move the byte across by 8 bits. I don't know how to do that in VB, but that's the general idea. You could just multiple by 2 to the power of 8, 2 to the power of 16 and 2 to the power of 24, if you can't find the shift operator. Oops - this is the C# forum. 123 << 24 + 212 << 16 + 4 << 8 + 3 would move them so they were in order, left to right. I'm sure that's not big endian, so get the order of digits right and that should work. http://www.codeproject.com/KB/cs/leftrightshift.aspx[^] explains how it all works. There's at least one other article that has a helper class you may want to check out.

          Christian Graus No longer a Microsoft MVP, but still happy to answer your questions.

          1 Reply Last reply
          0
          • D ddspliting

            declaring a new IP address Dim add As IPAddress(New Address As Long) the long value of IP Address? how to find that? it says like a value 0x3l3443 in big endian format... how to convert IP to big endian or Long?

            A Offline
            A Offline
            Alan N
            wrote on last edited by
            #5

            Are the IPAddress.NetworkToHostOrder and IPAddress.HostToNetworkOrder methods of any use to you? Alan.

            1 Reply Last reply
            0
            Reply
            • Reply as topic
            Log in to reply
            • Oldest to Newest
            • Newest to Oldest
            • Most Votes


            • Login

            • Don't have an account? Register

            • Login or register to search.
            • First post
              Last post
            0
            • Categories
            • Recent
            • Tags
            • Popular
            • World
            • Users
            • Groups