473,385 Members | 1,379 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

Networks with no DNS

I have written a .net program that runs on a pocketPC that talks
wirelessly to a non .net program on a sever though sockets. The program
works fine on our network here, but on the customers it gets an
exception "No such host is known". I do not think their network has a
DNS server. Here is code I use to connect. The string ServerAddr is the
IP address of the server in string form.

socket = new Socket(AddressFamily.InterNetwork, SocketType.Stream,
ProtocolType.Tcp);
socket.Blocking = true;
IPHostEntry IPHost = Dns.GetHostByAddress(IPAddress.Parse(ServerAddr));

string[] aliases = IPHost.Aliases;
IPAddress[] addr = IPHost.AddressList;
IPEndPoint ipepServer = new IPEndPoint(addr[0], Port);
socket.Connect(ipepServer);

If it would help I could give you the results of IPConfig when run from
the command line on the server. I can also ping the server from the
PocketPC so I know that it can see the server.
Nov 16 '05 #1
3 1410
Why not just use the IP address of the destination of that connection,
rather than translating it backward to a host name and then resolving the
name again? That is:

socket.Connect( new IPEndPoint( IPAddress.Parse("1.2.3.4"), portnumber ) );

Paul T.

"Joe Bain" <JB*********@nospan.addonsystems.com> wrote in message
news:ua**************@TK2MSFTNGP12.phx.gbl...
I have written a .net program that runs on a pocketPC that talks
wirelessly to a non .net program on a sever though sockets. The program
works fine on our network here, but on the customers it gets an
exception "No such host is known". I do not think their network has a
DNS server. Here is code I use to connect. The string ServerAddr is the
IP address of the server in string form.

socket = new Socket(AddressFamily.InterNetwork, SocketType.Stream,
ProtocolType.Tcp);
socket.Blocking = true;
IPHostEntry IPHost = Dns.GetHostByAddress(IPAddress.Parse(ServerAddr));

string[] aliases = IPHost.Aliases;
IPAddress[] addr = IPHost.AddressList;
IPEndPoint ipepServer = new IPEndPoint(addr[0], Port);
socket.Connect(ipepServer);

If it would help I could give you the results of IPConfig when run from
the command line on the server. I can also ping the server from the
PocketPC so I know that it can see the server.

Nov 16 '05 #2
Thanks I will try this. I am new to .net, I am a Delphi programmer by
heart, and had not found any examples for connecting without using the
DNS class. Thanks for your help.

Paul G. Tobey [eMVP] wrote:
Why not just use the IP address of the destination of that connection,
rather than translating it backward to a host name and then resolving
the name again? That is:

socket.Connect( new IPEndPoint( IPAddress.Parse("1.2.3.4"),
portnumber ) );

Paul T.

"Joe Bain" <JB*********@nospan.addonsystems.com> wrote in message
news:ua**************@TK2MSFTNGP12.phx.gbl...
I have written a .net program that runs on a pocketPC that talks
wirelessly to a non .net program on a sever though sockets. The
program works fine on our network here, but on the customers it
gets an exception "No such host is known". I do not think their
network has a DNS server. Here is code I use to connect. The string
ServerAddr is the IP address of the server in string form.

socket = new Socket(AddressFamily.InterNetwork, SocketType.Stream,
ProtocolType.Tcp);
socket.Blocking = true;
IPHostEntry IPHost =
Dns.GetHostByAddress(IPAddress.Parse(ServerAddr));

string[] aliases = IPHost.Aliases;
IPAddress[] addr = IPHost.AddressList;
IPEndPoint ipepServer = new IPEndPoint(addr[0], Port);
socket.Connect(ipepServer);

If it would help I could give you the results of IPConfig when run
from the command line on the server. I can also ping the server
from the PocketPC so I know that it can see the server.


Nov 16 '05 #3
"Joe Bain" <JB*********@nospan.addonsystems.com> wrote in message
news:Ob**************@TK2MSFTNGP12.phx.gbl...
Thanks I will try this. I am new to .net, I am a Delphi programmer by
heart, and had not found any examples for connecting without using the
DNS class. Thanks for your help.


Putting your code & Paul's code together, we get:
socket = new Socket(AddressFamily.InterNetwork, SocketType.Stream,
ProtocolType.Tcp);
socket.Blocking = true;
IPEndPoint ipepServer = new IPEndPoint(IPAddress.Parse(ServerAddr),
Port);
socket.Connect(ipepServer);

That should be a simple drop-in replacement for what you first posted.

--
Truth,
James Curran
Home: www.noveltheory.com Work: www.njtheater.com
Blog: www.honestillusion.com Day Job: www.partsearch.com
(note new day job!)
Nov 16 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: Abhilasha | last post by:
As the subjects suggest i need the kind of problems which are faced by ISP's on SMS Networks Please mail me at abhilasha@4cplus.com
2
by: John Walton | last post by:
Hello, again. I'm back with my instant messenger project. My teacher has assigned us to write our papers, excluding the procedure, results, and conclusion. One of my topics is going to be...
6
by: Tom Kent | last post by:
I have a computer with two network cards (attached to seperate networks) and I am having trouble getting my C# application to send its multicast packets on a specific one. It receives just fine...
1
by: Joe Black | last post by:
Hi all, I'm studing affiliate marketing networks, and I was wondering if anybody knows how Affiliate Service Providers (ASPs)like cj.com or linkshare.com track successful sales on merchant...
0
by: masterjuan | last post by:
Networks Hacking (hack C:/ drives, severs...)and security holes all on my website & hacking commands and I explain ways of erasing your tracks so you dont get caught doing "bad" things... What do...
3
by: CoreyWhite | last post by:
A friend of mine just was over at my house explaining Neural Networks and I understood it as well as I could. Here is my own explination. A neural network has to first run in a loop 1,000's of...
1
by: satya0674 | last post by:
Hi Everybody , Is any one have the soft copy of the book Developing IP Multicast Networks: The Definitive Guide to Designing and Deploying CISCO IP Multi- cast Networks by Beau...
0
by: Guy007 | last post by:
I am writing an application that works on Deterministic Finite State Automata, and processes them to gather some information. I, however, need to draw the DFAs (networks). I am searching for some...
0
by: Guy007 | last post by:
I need to draw large networks (Finite state automata, with nodes connected by directed edges). I am searching for some DLL or class that will help me draw these networks in c#. So far, I have...
10
by: iheartvba | last post by:
Hi, I hatve 2 peer to peer networks which I am triying to connect via the Windows XP VPN application. I have achieved the following: 1. Connect to Remote Office 2. Ping all Computer IP...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.