Thread: can i force connecting to local web server via internet network ?

  1. #1
    Registered User
    Join Date
    Mar 2008
    Posts
    58

    can i force connecting to local web server via internet network ?

    Hello all
    this is general question , if i have web server installed in my local pc and i have client that connecting to that web server
    can i force it always to go via the internet network ?
    the reason im asking is .. that im noticed when i close my internet connection i still can connect to my web server.

  2. #2
    Banned
    Join Date
    Nov 2007
    Posts
    678
    you can always connect to a local server using "127.0.0.1" or "localhost" addresss, so to make sure you connect only when internet connection is up, you should connect to your server using the same address that is used to access it over the internet.

    i suppose you should be already using a server address which is available over internet, and i am confused that, why, you still have a problem

  3. #3
    Kernel hacker
    Join Date
    Jul 2007
    Location
    Farncombe, Surrey, England
    Posts
    15,677
    Most network stacks knows it's own IP address, so even if you send to 192.168.0.1, it will know that you don't need to go out on the real network to get there...

    --
    Mats
    Compilers can produce warnings - make the compiler programmers happy: Use them!
    Please don't PM me for help - and no, I don't do help over instant messengers.

  4. #4
    Officially An Architect brewbuck's Avatar
    Join Date
    Mar 2007
    Location
    Portland, OR
    Posts
    7,396
    Quote Originally Posted by matsp View Post
    Most network stacks knows it's own IP address, so even if you send to 192.168.0.1, it will know that you don't need to go out on the real network to get there...

    --
    Mats
    Yes, you'd have to have some very weird routes to cause a packet to leave the network it's already destined for. People do that sort of thing when testing networks, but I doubt there's any real "network" here (just a PC connected to an ISP?)

  5. #5
    Cat without Hat CornedBee's Avatar
    Join Date
    Apr 2003
    Posts
    8,895
    And the other question is, why would you want to do that anyway?
    All the buzzt!
    CornedBee

    "There is not now, nor has there ever been, nor will there ever be, any programming language in which it is the least bit difficult to write bad code."
    - Flon's Law

  6. #6
    Malum in se abachler's Avatar
    Join Date
    Apr 2007
    Posts
    3,195
    Other than writing a bounce server or rewriting your socket stack, no there is no way of doing it. The IP stack correctly forwards any packets not destined for the local machine to the gateway. A call to teh recv function sorts throught eh packets in teh socket stack and returns any that are bound for the associated socket. There is no way to force the socket stack to send a packet out to the gateway, only to then recieve it back, as it woudl then immediately send it out again until the TTL was exhausted and the packet would be dropped. I suppose if you are runnign a linux distro you could make the socket stack forward any packets with a TTL above a certain value, but why woudl you want to do this anyway?

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Apache Web Server
    By Mecnels in forum A Brief History of Cprogramming.com
    Replies: 1
    Last Post: 04-14-2003, 07:39 AM
  2. Web Server in Router Network...
    By Aidman in forum Tech Board
    Replies: 15
    Last Post: 01-17-2003, 10:24 PM
  3. IE 6 status bar
    By DavidP in forum Tech Board
    Replies: 15
    Last Post: 10-23-2002, 05:31 PM
  4. Web Hosting SQL Server
    By Unregistered in forum A Brief History of Cprogramming.com
    Replies: 0
    Last Post: 06-14-2002, 07:00 PM
  5. Replies: 1
    Last Post: 06-07-2002, 11:22 AM