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:
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.
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.
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.
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
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....!
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?
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.
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:
#INCLUDE
#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:" tag will associate the
entry with the domain specified by . 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 is always preloaded although it will not
be shown when the name cache is viewed.
Specifying "#INCLUDE " will force the RFC NetBIOS (NBT)
software to seek the specified and parse it as if it were
local. 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
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.