Pages: [1]   Go Down
Author Topic: Referencing Server By Server Name - Issue  (Read 1386 times)
0 Members and 1 Guest are viewing this topic.
Offline Offline
Newbie
*
Karma: 0
Posts: 5
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Hi Everyone:

I think this related to my network; but, I am starting to just need some ideas about what to look at.
I am running a Mega with an Ethershield.  The "host" application is running on a Windows 7 PC.

When I try to connect to the "Server" via "IP" and "Port"... everything works fine.
When I try to connect to the "Server" via "Server Name" and "Port"... it will not connect.
These are defined in EthernetClient.h.

A few observations about this:
1. Server Name Initialization
    a. char szServerName[] = {"ServerSys"};  <- I NEVER see "SeverSys" anywhere in the WireShark output.
    b. char szServerName[] = {"ServerSys\0"}; <- I definitely see "ServerSys" in the WireShark output. 
        Does this make sense to anyone or was I imagining it?
        Since the call is a const char *, I fugured the name alone should just work.

2. I asked for an IP via DHCP...   everything returned perfectly.
    After the call, I pulled the:
        IP, Subnet Mask, Defualt Gateway and DNS Servers... except for the IP, these matched the PC perfectly.
    I was pretty impressed seeing the "exchange" on WireShark.

3. The Windows Firewall as seen through WireShark:
     It seems as if the "Server" can see the Arduino board if the Firewall is "ON" or "OFF"; however,
                       the server responds in very different ways.

     Firewall ON: 243 LOCAL MASTER ANNOUNCE... "ServerSys" <- I was shocked to see that the PC even recognized the board.
     Firewall OFF: 150 SOLICIT XID 0xcbee...  with "ServerSys" embedded in the Packet

     Unfortunately, there is "no connect" on this.

Again, I do not think this is the Arduino setup or "perhaps" even my code - since I can get it to run. 
This is "probably" do to networking and I'm just not seeing it.

Any thoughts would be greatly appreciated.

Thanks

-Rick











Logged

Miramar Beach, Florida
Offline Offline
Faraday Member
**
Karma: 115
Posts: 5359
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

This is DNS. Does the server name resolve using DNS? From a command prompt on your computer:
nslookup ServerSys
or maybe this
nslookup ServerSys.yourdomain.com
Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 5
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

After reading your reply...  I agree.

After reading my reply, I should have been clearer about my setup.
The Host PC (Windows 7) is actually the Server.
I can't use nslookup; but, I sure as heck did not think of that.

This gives me some more ideas to try. 
Thank you....!
Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 5
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Hi Everyone:

I figured it out what the issue was...  The code is working fine and always was.  (Still have an issue though.)

The DNS is provided by my ISP.
When I tried to connect to my internal server by "Name", the ISP actually found the same name on the Internet.
That server is owned by the U.S. Govt and I've been banging away at it for the past 4 days.   (Yes, I am waiting for a call.)

So... before I attempt to do any more damage...
Does anyone have any thoughts about how I can fix this? 
Do I need to change the Name of my Server?
Is there some "command" that I can put in the EthernetClient code to only resolve internally?

Thanks

-Rick
Logged

Switzerland
Offline Offline
Faraday Member
**
Karma: 96
Posts: 4678
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Resolving internally is not that easy. You would have to have your own DNS server and configure it correctly. What you probably think are your "internal" names, are the WINS (Windows Internet Name Service) names. Although the name suggests this has nothing to do with Internet standards and is a proprietary Microsoft protocol used only in their world. For internal networks it's probably best to use the IP addresses because supporting a DNS setup is nothing for the average home user.
Logged

0
Offline Offline
Tesla Member
***
Karma: 114
Posts: 8894
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Not sure what you are trying to accomplish, but you might take a look at the hosts and lmhosts files on your computer. Below is the lmhost file from my netpad (no entries in this file).

# Copyright (c) 1993-1999 Microsoft Corp.
#
# This is a sample LMHOSTS file used by the Microsoft TCP/IP for Windows.
#
# This file contains the mappings of IP addresses to computernames
# (NetBIOS) names.  Each entry should be kept on an individual line.
# The IP address should be placed in the first column followed by the
# corresponding computername. The address and the computername
# should be separated by at least one space or tab. The "#" character
# is generally used to denote the start of a comment (see the exceptions
# below).
#
# This file is compatible with Microsoft LAN Manager 2.x TCP/IP lmhosts
# files and offers the following extensions:
#
#      #PRE
#      #DOM:<domain>
#      #INCLUDE <filename>
#      #BEGIN_ALTERNATE
#      #END_ALTERNATE
#      \0xnn (non-printing character support)
#
# Following any entry in the file with the characters "#PRE" will cause
# the entry to be preloaded into the name cache. By default, entries are
# not preloaded, but are parsed only after dynamic name resolution fails.
#
# Following an entry with the "#DOM:<domain>" tag will associate the
# entry with the domain specified by <domain>. This affects how the
# browser and logon services behave in TCP/IP environments. To preload
# the host name associated with #DOM entry, it is necessary to also add a
# #PRE to the line. The <domain> is always preloaded although it will not
# be shown when the name cache is viewed.
#
# Specifying "#INCLUDE <filename>" will force the RFC NetBIOS (NBT)
# software to seek the specified <filename> and parse it as if it were
# local. <filename> is generally a UNC-based name, allowing a
# centralized lmhosts file to be maintained on a server.
# It is ALWAYS necessary to provide a mapping for the IP address of the
# server prior to the #INCLUDE. This mapping must use the #PRE directive.
# In addtion the share "public" in the example below must be in the
# LanManServer list of "NullSessionShares" in order for client machines to
# be able to read the lmhosts file successfully. This key is under
# \machine\system\currentcontrolset\services\lanmanserver\parameters\nullsessionshares
# in the registry. Simply add "public" to the list found there.
#
# The #BEGIN_ and #END_ALTERNATE keywords allow multiple #INCLUDE
# statements to be grouped together. Any single successful include
# will cause the group to succeed.
#
# Finally, non-printing characters can be embedded in mappings by
# first surrounding the NetBIOS name in quotations, then using the
# \0xnn notation to specify a hex value for a non-printing character.
#
# The following example illustrates all of these extensions:
#
# 102.54.94.97     rhino         #PRE #DOM:networking  #net group's DC
# 102.54.94.102    "appname  \0x14"                    #special app server
# 102.54.94.123    popular            #PRE             #source server
# 102.54.94.117    localsrv           #PRE             #needed for the include
#
# #BEGIN_ALTERNATE
# #INCLUDE \\localsrv\public\lmhosts
# #INCLUDE \\rhino\public\lmhosts
# #END_ALTERNATE
#
# In the above example, the "appname" server contains a special
# character in its name, the "popular" and "localsrv" server names are
# preloaded, and the "rhino" server name is specified so it can be used
# to later #INCLUDE a centrally maintained lmhosts file if the "localsrv"
# system is unavailable.
#
# Note that the whole file is parsed including comments on each lookup,
# so keeping the number of comments to a minimum will improve performance.
# Therefore it is not advisable to simply add lmhosts file entries onto the
# end of this file.




Logged

Consider the daffodil. And while you're doing that, I'll be over here, looking through your stuff.   smiley-cool

Switzerland
Offline Offline
Faraday Member
**
Karma: 96
Posts: 4678
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

The hosts file is for your computer only, the Arduino will never see it and has nothing comparable. So if the Arduino is hosting a server you can enter the IP of it into your PC's hosts file together with a name and then access the server on the Arduino by using that name. But the other way round this does not work. If you wanna do that you have to set up a DNS server, register the IP and name there and ensure that the DHCP server is spreading that DNS server's IP as the DNS of the network.
Logged

Pages: [1]   Go Up
Jump to: