473,549 Members | 2,592 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

IP Address's

Is there any way to resolve the ip address of the host machine or a machine
at the other end of a network connection? I have created a client-server Tcp
project that only uses the TcpClient and TcpListener classes for the
connections.
I have tried:
Dns.Resolve("lo calhost").Addre ss[0].ToString();
but that only gives me "127.0.0.1"
I would prefer it though if I could resolve the address of the clients from
the server, rather than having to pass the IpAddress across the network.
Any ideas?
Thanks
Nov 16 '05 #1
2 2946
Hi,

It depends on how you accept incoming TCP connections in the TcpListener. If
you use AcceptSocket, it will return you a Socket instance which you can
query for RemoteEndPoint property.
If you however use AcceptTcpClient , you will have to create a derived class
to access the protected TcpClient's Socket property.

--
Sincerely,
Dmitriy Lapshin [C# / .NET MVP]
Bring the power of unit testing to the VS .NET IDE today!
http://www.x-unity.net/teststudio.aspx

"R2D2" <R2**@discussio ns.microsoft.co m> wrote in message
news:4D******** *************** ***********@mic rosoft.com...
Is there any way to resolve the ip address of the host machine or a
machine
at the other end of a network connection? I have created a client-server
Tcp
project that only uses the TcpClient and TcpListener classes for the
connections.
I have tried:
Dns.Resolve("lo calhost").Addre ss[0].ToString();
but that only gives me "127.0.0.1"
I would prefer it though if I could resolve the address of the clients
from
the server, rather than having to pass the IpAddress across the network.
Any ideas?
Thanks


Nov 16 '05 #2
I am using the AcceptTcpClient , how would I go about creating a derived class
to access the property?

"Dmitriy Lapshin [C# / .NET MVP]" wrote:
Hi,

It depends on how you accept incoming TCP connections in the TcpListener. If
you use AcceptSocket, it will return you a Socket instance which you can
query for RemoteEndPoint property.
If you however use AcceptTcpClient , you will have to create a derived class
to access the protected TcpClient's Socket property.

--
Sincerely,
Dmitriy Lapshin [C# / .NET MVP]
Bring the power of unit testing to the VS .NET IDE today!
http://www.x-unity.net/teststudio.aspx

"R2D2" <R2**@discussio ns.microsoft.co m> wrote in message
news:4D******** *************** ***********@mic rosoft.com...
Is there any way to resolve the ip address of the host machine or a
machine
at the other end of a network connection? I have created a client-server
Tcp
project that only uses the TcpClient and TcpListener classes for the
connections.
I have tried:
Dns.Resolve("lo calhost").Addre ss[0].ToString();
but that only gives me "127.0.0.1"
I would prefer it though if I could resolve the address of the clients
from
the server, rather than having to pass the IpAddress across the network.
Any ideas?
Thanks


Nov 16 '05 #3

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

Similar topics

21
15668
by: Alexander N. Spitzer | last post by:
If I have a machine with 3 virtual IP addresses (192.168.1.), how can I start 3 instances of the same RMI application (each started with different properties/configs), each listening on the port 1234, but each instance binds to a different ip address. that is to say: instance #1 binds to 192.168.1.5/port 1234 instance #2 binds to...
8
4583
by: YAN | last post by:
Hi, I want to get the mac address from a machine, which i have the IP address of that machine, how can i do that? I know how to get the mac address of the local machine from the following code: Dim mc As System.Management.ManagementClass Dim mo As System.Management.ManagementObject mc = New...
7
21279
by: Privacy Advocate | last post by:
//crossposted to: comp.lang.javascript, alt.comp.lang.javascript in an effort to get factual answers from JavaScript experts// Simply put; Is it possible to obtain the real (actual) IP address of someone (client) that visits a web site through an anonymous proxy if this person ONLY has JavaScript enabled in their browser? This is NOT a...
33
3132
by: baumann.Pan | last post by:
hi all, i want to get the address of buf, which defined as char buf = "abcde"; so can call strsep(address of buf, pointer to token);
4
6278
by: andreas.w.h.k. :-\) | last post by:
How do I change the address location in the wsdl <wsdl:port name="SearchSoap12" binding="tns:SearchSoap12"> <soap12:address location="http://searchservices/engine/search.asmx" /> </wsdl:port> Anderas
1
2923
by: Phoenix_ver10 | last post by:
I have a mailing list with multiple names going to the same addresses. I need one address with all the names for that address on it. I checked out the example on microsoft's site, but A: It doesn't work (error that there is an extra parenthise (sp?) ) and B: Will only let in two names for each record. If there are three, the middle on is...
1
2350
by: Jamie J. Begin | last post by:
I'm very new to the world of Python and am trying to wrap my head around it's OOP model. Much of my OOP experience comes from VB.Net, which is very different. Let's say I wanted to create an object that simply outputted something like this: Developer Detroit Michigan
6
7022
by: Nicolas Noakes | last post by:
Hello, I would like to convert to following process to code. Any advice is welcome. I have a hardware device which requires the this procedure to set it's IP address. First create an static ARP entry for the device's MAC address and the desired IP address. Then telnet to this IP address on TCP port 1. This will set the device to...
36
3362
by: Julienne Walker | last post by:
Ignoring implementation details and strictly following the C99 standard in terms of semantics, is there anything fundamentally flawed with describing the use of a (non-inline) function as an address? I keep feeling like I'm missing something obvious. -Jul To keep things in context, this is in reference to describing functions to a...
1
3113
by: saravanatmm | last post by:
I need javascript code for validate the email address. Email address field cannot allowed the capital letters, special characters except '@' symbol. But can allowed the small letters, numeric numbers. Now i use this script for validate the email address. But it allows the cpital letters otherwise its working correctly. SCRIPT FUNCTION ...
0
7726
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. ...
0
7967
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
1
7485
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For...
0
7819
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the...
0
6052
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then...
1
5377
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes...
0
5097
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert...
0
3488
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
1064
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.