Amazing failures in C# ???

  • Thread starter Thread starter schaf
  • Start date Start date
S

schaf

Hi NG !
In my application I have some amazing failures detected. Maybe you can
help to solve my confusion.

1.) Why the following code does not return the same result ?
Dns.GetHostName(); \\PCname
and
ns.GetHostByAddress(<LocalIPAddress>).HostName; \\PCname inclusive the
domain

2.) I copy files from dir DirA to dir DirB. The file DirA\FileA has a
hidden flag, the file DirA\FileB not. On the DirB I set a read-only
flag for all files (FileA and FileB) after the copy process.
Now if I do the same once again, I have to remove the read-only flag on
DirB\FileA and DirB\FileB to ensure a successful copy process. Ok no
problem, now I have the same situation on the DirB (DirB\FileA with
hidden and read-only flag; DirB\FileB with a read-only flag).
Now I set the hidden flag on DirB\FileB (manually).
If I start the same copy process (which removes the read-only flag of
all DirB files) it will crash because of the File DirB\FileB. In the
code the read-only flag would be removed, but it is not possible the
override the file ! Why it is possible to override a file with hidden
flag, if it was set before the copy process and why it is not possible
when i change the flag by hand ?
(Both files have the same fileAttributes set (35 => Archive, Hidden,
Readonly) before removing the readonly flag and also after (34 =>
Archive, Hidden), but overriden the file DirB\FileB is not possible)
????

3.) My Gui looks very good on my computer, but if the same application
runs on another computer, the texts of the listboxes would not be shown
! Why ?

Thanks for hints
Marcel
 
schaf said:
1.) Why the following code does not return the same result ?
Dns.GetHostName(); \\PCname
and
ns.GetHostByAddress(<LocalIPAddress>).HostName; \\PCname inclusive the
domain

Because they are different methods? GetHostByAddress / GetHostEntry use
a DNS server. The machine may be multi-homed (i.e. have multiple IP
addresses) each with a different domain; it may have aliases etc.

GetHostName() can only return one value.
2.) I copy files from dir DirA to dir DirB.

You should write a small sample program that demonstrates this behaviour
and repost in a separate topic - it's too hard to follow, IMHO.
3.) My Gui looks very good on my computer, but if the same application
runs on another computer, the texts of the listboxes would not be shown

Ditto - more details needed, reproduction code so people can test.

-- Barry
 
| 3.) My Gui looks very good on my computer, but if the same application
| runs on another computer, the texts of the listboxes would not be shown
| ! Why ?

Change your graphic resolution to be the same as the other computer. Does
you see the same issue? If so, you need to adjust your app to also look
right with lower resolutions.
 
schaf said:
Hi NG !
In my application I have some amazing failures detected. Maybe you can
help to solve my confusion.

1.) Why the following code does not return the same result ?
Dns.GetHostName(); \\PCname
and
ns.GetHostByAddress(<LocalIPAddress>).HostName; \\PCname inclusive the
domain

The former probably uses a local lookup to get the hostname and the latter
probably goes to the DNS server to get that information. The former is
usually assigned by DHCP, which the latter is configured in DNS.
2.) I copy files from dir DirA to dir DirB. The file DirA\FileA has a

3.) My Gui looks very good on my computer, but if the same application
runs on another computer, the texts of the listboxes would not be shown

Sample code please? There could be 100 different reasons, depending upon how
that text gets there, what locality is setup, etc.
 
Back
Top