Smart phone to Port 80?

Discussion in 'Programmer's Corner' started by rougie, Aug 8, 2012.

  1. rougie

    Thread Starter Active Member

    Dec 11, 2006
    410
    2
    Hello,

    Okay, I finally had some success with connecting my iPhone to my web server board.

    My web server board consists of an PIC32 MCU which is connected to an Ethernet adapter chip called: LAN8720A. This chip has the ability to connect to a LAN via an RJ45 connector. My LAN simply consists of one linksys router which connects to all my other computers on the network *and* my web server board.

    Note that a web page is programmed in HTML and resides in my PIC32 MCU of the web server board.

    So basically, I have my smart phone's WIFI setting set to "on" so that my iPhone can communicate with my office's WIFI connection. So while I am at the office, I can log into my web server which is programmed in a PIC32 MCU of my web server board by simply entering the following IP address in Safari's address bar. like this: "192.169.1.60"

    Everything works and I am able to communicate from my iPhone to my web serve board... I must admit, it is quite the experience when you do this for the first time. :p

    My problem now is if I leave the office and disable the WIFI on my iPhone, I would still like to communicate with my iPhone and the web server board but this time through my ISP and my DSL modem.

    I have read many articles about this and they say to open port 80 on my PC. But this has nothing to do with my computer ... right? This is where it gets shady for me. I tried to put the IP address in Safari's address bar (like I did at the office) but this time since there is no WIFI it didn't work.

    Can someone explain to me what is supposed to happen here. I am unfortunately confused again with the logistics. How can my phone's browser see my router and the go to the IP address of my web server board??

    Confused :(

    Thank you for all help!
    r
     
  2. Markd77

    Senior Member

    Sep 7, 2009
    2,803
    594
    At your office type "what is my ip" into google. Try that. You probably have to configure your router to transfer incoming requests to the right place.
     
  3. rougie

    Thread Starter Active Member

    Dec 11, 2006
    410
    2
    Hi Markd77,

    Since my innitial post I have done some reading up on this. I set my linksys router for port forwarding on port 80 which is the port my web server board uses. I also associated my web server board's IP address which is '192.168.1.60' and nada!

    Safari does not see this address ?? help!!!

    regards
     
  4. Markd77

    Senior Member

    Sep 7, 2009
    2,803
    594
    Anything starting 192.168.. is a local network only address. The outside world sees a different address which you have to find out like in my first post.
     
  5. rougie

    Thread Starter Active Member

    Dec 11, 2006
    410
    2
    Yes but ..."what is my IP" in my google browser will give me the IP of my router as seen by the Internet ?????

    Okay let me try.....
    it says that my IP address is:

    70.52.57.92

    which is none of my LAN's ip addresses. So you are saying that this address is what I should put in my router or in safari's browser ?

    confused?
     
  6. cheezewizz

    Active Member

    Apr 16, 2009
    82
    10
    That 70.52.x.x is the IP your provider has assigned to your router, so provided you've forwarded port 80 to the local address of your webdev board, 192.168.1.60, you can reach it when you're out and about by going to 70.52.x.x on your iPhone...
     
  7. mcgyvr

    AAC Fanatic!

    Oct 15, 2009
    4,769
    969
    Your home network needs a static IP address (or you can use dynamic dns services like no-ip.com for a free one) Then you enable port forwarding and forward port 80 to the IP address of your lan board. Then from outside your home network you type the ip address given by the dynamic dns service and the port and you should be all good to to.
     
  8. cheezewizz

    Active Member

    Apr 16, 2009
    82
    10
    To be fair I think whether or not you need to use some like no-ip.com depends on just how dynamic the dynamic IPs used by your provider are. For instance, mine hasn't changed in the two years I've been using my ISP. But it is a good point.
     
  9. Markd77

    Senior Member

    Sep 7, 2009
    2,803
    594
    It's also possible that your ISP will block the web server from working.
     
  10. rougie

    Thread Starter Active Member

    Dec 11, 2006
    410
    2
    Okay, wow! it works!

    I typed in the 70.52.x.x address in safari's address bar and I was able to connect! In my router I had to assign my board's port forwarding IP address. However, in the refresh part of my MCU code, I had to assign the 70.52.x.x address. This was because I was connecting but then I would lose the connection on the next refresh! I was wondering, the IP address 70.52.x.x is not an address I should tell people ... right???

    One last thing though. What happens if I have my router connected to a switch which expands the number of ports in my LAN. I further experimented by connecting my web server board to the switch instead of the router and this does not work. Shouldn't the switch be transparent as it doesn't need no IP right??? I don't think I can even set ports in this switch!!!

    thanks all for your help!

    r
     
    Last edited: Aug 9, 2012
  11. osx-addict

    Member

    Feb 9, 2012
    122
    9
    All switches (unmanaged anyway) should be completely transparent and only work as port splitters (for lack of a better term).. I've got about 30+ ports at home on our gigabit network and have no issues with port forwarding outside traffic to anything behind my cisco router/firewall. Make sure that your PIC32 device has the same IP as it did before you relocated it.. You may find that the IP changed..

    Also -- a word of caution here -- not only for you but for others that might try what your doing.. Anyone can try to login to your PIC32 device -- of course they likely will not know it's an MCU board and depending on how your software is designed and what it is capable of doing, you may find people messing with whatever it is capable of doing -- particularly IF you didn't include some sort of login/security features..

    One way to limit this issue is to use a non-port 80 port -- something else entirely (and not 8080 which is another well-known port) such as 57129 -- which can still be found with port sniffers (and other tools) but much less likely. In that case your browser URL would be somthing like :

    HTH!
     
  12. rougie

    Thread Starter Active Member

    Dec 11, 2006
    410
    2
    Hello osx-addict,

    hummmm its weird, on the router it works but on the switch it doesn't ?? I tried to unpug the router and the switch one at a time and still nothing! :(

    When my web server connects to the switch instead of the router, should I use a cross-through cable instead of straight through one?

    Also, I have done port forwarding in my linksys router and I also set port triggering... Please view attachments.

    I am wondering if there is any other router options that need to be set for this?? :confused:

    >>>Also -- a word of caution here -- not only for you but...
    Well, in my HTML code, I can provide a pass code page before going to the main page... no?

    Regards
    R
     
  13. osx-addict

    Member

    Feb 9, 2012
    122
    9
    Make sure that your IP address is still the same -- the one that the PIC is having assigned to it -- although I don't believe I've ever run across a switch that will change the IP address of a device plugged into it.. But I suppose it's possible..

    I don't believe you need any sort of cross-over cable..
     
  14. rougie

    Thread Starter Active Member

    Dec 11, 2006
    410
    2
    Hello osx-addict,

    >Make sure that your IP address is still the same -- the one that the PIC is having assigned >to it

    I really haven't changed any IP addresses !! My IP address in my PIC is static as:
    '192.168.0.60'

    My PIC also has the default gateway, subnet mask and dns rerspectively as:
    '192.168.1.1'
    '255.255.255.0'
    '207.164.234.129'

    This info has never changed !?!

    really confused here !!!

    regards
    r
     
  15. osx-addict

    Member

    Feb 9, 2012
    122
    9
    How about trying a different switch? Just a thought,.. I've never seen what your seeing with any switch I've ever used.. -- not even when AUI was king..
     
  16. rougie

    Thread Starter Active Member

    Dec 11, 2006
    410
    2
    I am using a Dynex model# DX-ESW8!

    Everything else works on this switch except this bloody MCU server LOL!!!
    I don't think its the switch !!

    It gets better. I even tried it locally in the LAN. When the web server board is connected to the router I can ping it from my PC. When it is connected to the switch I can't ping it ... ???

    I was wondering... is there a default gateway address in a switch ??

    r
     
    Last edited: Aug 10, 2012
  17. osx-addict

    Member

    Feb 9, 2012
    122
    9
    Stupid question if you don't mind.. Make sure you have the switch connected properly.. There's ONE uplink port (left most RJ45 on the rear panel when it faces you) -- make sure the PIC board is NOT plugged into that -- the connection to the router goes there.. The PIC can then be connected to any of the other ports.. If that's all correct, try plugging something else into the switch and try pinging it -- try other ports on the switch.. Perhaps one port is blown?

    Edit : Nevermind about the left most port being the only uplink port -- the manual claims any port can be the uplink port..
     
  18. rougie

    Thread Starter Active Member

    Dec 11, 2006
    410
    2
    Yes, I have a network printer plugged into this switch at: 192.168.1.50

    This pings sucessfully!

    I tried different ports and the printer works but the PIC doesn't :-(

    This is a little beyond my scope of Etherent knowledge but let me ask you anyways ... can it be something to do with the ICMP that my PIC board is missing or not set ?? And if so how can we confirm this???

    r
     
  19. osx-addict

    Member

    Feb 9, 2012
    122
    9
    I don't know.. I'm wondering if the ethernet controller on the PIC is not completely following some sort of standard feature?? You might want to look into that angle perhaps.. One other thought -- is the ethernet interface hardware on the PIC capable of 10/100 or is it fixed? Just thinking.. I doubt it as I don't think I've ever seen anything like that before.. Hmm .. If something else pops in my head I'll drop another suggestion but I'm out for now..

    Have you tried a network scanning app to see if it can see the PIC?
     
  20. rougie

    Thread Starter Active Member

    Dec 11, 2006
    410
    2
    >I don't know.. I'm wondering if the ethernet controller on the PIC is not completely >following some sort of standard feature??

    Could very well be. I have forwarded this question to the provider of the board. I will wait and see.

    >One other thought -- is the ethernet interface hardware on the PIC capable of 10/100 or is >it fixed?

    Well, it surely worked with the router ... which is 10/100 !


    >Have you tried a network scanning app to see if it can see the PIC?

    Sorry, I have never used a network scanning app... I wouldn't know where to get one asides from taking a shot in the dark by googling the term and downloading the first one that I see.

    In the meantime, If I have any other questions I will definitely get back to you!

    thanks for your help!
    r
     
Loading...