Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6207085
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T05:34:03+00:00 2026-05-24T05:34:03+00:00

I am writing a (rather simple :) networking application, and am testing it using

  • 0

I am writing a (rather simple 🙂 networking application, and am testing it using localhost:27488 (127.0.0.1:27488).
I am using a System.Net.Sockets.TcpClient for the connection, which takes a System.Net.IPAddress to specify the host… the only thing is, I can’t figure out how to initialize the class with the right IP address. I went over the MSDN docs and it says it takes either a Byte(4) or an Int64 (long) for the address.
The probelm is, when I initialize the IPAddress like this:

Dim ipAddr As New System.Net.IPAddress(127001)

it returns the address as 25.240.1.0. From what I understand from the docs, 127001 should return 127.0.0.1… Maybe I missed something there? http://msdn.microsoft.com/en-us/library/13180abx.aspx

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-24T05:34:04+00:00Added an answer on May 24, 2026 at 5:34 am

    Short answer: use TcpClient.Connect( String, Int ) instead; it accepts an IPv4/IPv6 address or hostname/alias, so you are not limited to connecting by IP. e.g.:

    Dim client As TcpClient
    client.Connect( "localhost", 27488 )
    client.Connect( "127.0.0.1", 27488 )
    

    But where did 25.240.1.0 come from? Try the following:

    • Open Calc, switch to Programmer view, select Dec
    • Type in 127001, then switch to Hex
    • Write out the result, adding zeroes on the left to pad to 4 bytes/32 bits: 0001F019
    • Separate that number into individual bytes: 00 01 F0 19
    • Reverse the byte order: 19 F0 01 00
    • Convert each byte back to decimal: 25 240 1 0
    • With dots: 25.240.1.0

    Why reverse the bytes? Your processor architecture is little-endian; numbers are represented in memory with the least significant byte first. IPv4 addresses are standardized to big-endian format (most significant byte first; a.k.a. network order). The IPAddress( Int64 ) constructor is reversing the bytes to convert from LE to BE.

    Reversing the steps above, the correct value for loopback in the IPAddress( Int64 ) constructor would be &H0100007F (hex) or 16777343 (decimal).

    The IPAddress( Byte[4] ) constructor takes the byte array in network order, so that would be New Byte() { 127, 0, 0, 1 }

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm writing an ASP.NET 3.5 web application. There is a rather complex input form
I'm writing a simple Qt4 application in Ruby (using qtruby ) to teach myself
I'm writing a rather simple application that uses GWT, Hibernate and Google Guice (with
I'm writing a very simple web application in ASP.NET MVC 2.0 which is used
I have a rather simple threading question. I'm writing a simple utility that will
A very simple question: I am writing and running my R scripts using a
I am writing a simple ASP.NET MVC web app. At this point, I am
I have a rather simple multi-threaded VCL gui application written with Delphi 2007. I
I am writing a simple application that I would like to control with a
I am writing a relatively small and simple Windows Service, and using Moles to

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.