473,396 Members | 2,013 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,396 software developers and data experts.

Need some urgent help please!!

Hello All!

I need to extract Socket object from a TcpClient object, in order to get
client's IP address.
I've found the following article that describes how to derive from TcpClient
class and use the Client property (that I need so much...!).
http://msdn.microsoft.com/library/de...lienttopic.asp
I created such class (as described) but I failed to use it...
My current code is:

oTcpClient = oTcpListener.AcceptTcpClient();

I tried to cast the oTcpClient to the new derived class (named
clsAdvancedTCPClient), but I got an error: "This cast is not valid"
Can someone explain me please how can I get the requested Client property
from the TcpClient object?

Thanks in advanced!
Tom Rahav.
Nov 17 '05 #1
2 1332
"Tom Rahav" <to******@nospam.nospam> wrote in message
news:ue**************@TK2MSFTNGP09.phx.gbl...
Hello All!

I need to extract Socket object from a TcpClient object, in order to get
client's IP address.
I've found the following article that describes how to derive from TcpClient class and use the Client property (that I need so much...!).
http://msdn.microsoft.com/library/de...lienttopic.asp I created such class (as described) but I failed to use it...
My current code is:


You could use reflection to get hold of it. If you move to v2 or .Net the
property is public.

--
Regards,

Tim Haughton

Agitek
http://agitek.co.uk
http://blogitek.com/timhaughton
Nov 17 '05 #2
Hi,

What you did? the line of code gives no clues, All I can think of it that
oTcpClient is an instance of your derived class. If so that is why you are
getting the error.

The difference with the example and your situation is that it's
Listener.AcceptTcpClient the one that is creating the instance, therefore he
knows nothing about your new class. so you cannot cast it as you want.
IMO, the only way is to use reflection :( , not a very clear solution but
it's the only available now.

IIRC in 2.0 Client is public
cheers,

--
Ignacio Machin,
ignacio.machin AT dot.state.fl.us
Florida Department Of Transportation
"Tom Rahav" <to******@nospam.nospam> wrote in message
news:ue**************@TK2MSFTNGP09.phx.gbl...
Hello All!

I need to extract Socket object from a TcpClient object, in order to get
client's IP address.
I've found the following article that describes how to derive from
TcpClient class and use the Client property (that I need so much...!).
http://msdn.microsoft.com/library/de...lienttopic.asp
I created such class (as described) but I failed to use it...
My current code is:

oTcpClient = oTcpListener.AcceptTcpClient();

I tried to cast the oTcpClient to the new derived class (named
clsAdvancedTCPClient), but I got an error: "This cast is not valid"
Can someone explain me please how can I get the requested Client property
from the TcpClient object?

Thanks in advanced!
Tom Rahav.

Nov 17 '05 #3

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

Similar topics

1
by: Jenny | last post by:
Need urgent help for an unsolved problem. In our ASP web application, we creat a Back button and if user click on this button, it execute history.go(-1) to go back to the previous page. All our...
1
by: eduardo | last post by:
Hi, Please help me with the post of Q&A 5.0 of Symantec. PLS Urgent Thank you. Eduardo oshar@entelchile.net
1
by: MR | last post by:
Hi, it has been observed that when we try to instantiate a .Net dll for the first time in a session (e.g. from an exe in .Net), it takes almost 10 times compared to subsequent instantiations. ...
17
by: Saps | last post by:
Hi all. Can anyone help me here. I have loads of .sql files and i need a way to call these from my asp page so the user can run them from the browser. Meaning i have a page with a list of all...
3
by: settyv | last post by:
Hi, I need to generate PDF stream when i click on Linkbutton in datagrid ..At present i hardcoded the DMS Id and now it is working.But i need to pass DMS ID when click linkbutton.How can i do...
0
by: Balamurugan Ranganathan | last post by:
I want to calculate the execution time of a sql query through C#.net this is to analysis two queries to compare their execution time it is very Urgent Please help me Please help Me ...
6
by: jenipriya | last post by:
Hi all... its very urgent.. please........i m a beginner in oracle.... Anyone please help me wit dese codes i hv tried... and correct the errors... The table structures i hav Employee (EmpID,...
5
by: Ra7al143 | last post by:
hi everybody, i need help please with the following example: i have the following table: id -------------- coursenumber 123 -------------- ...
0
by: sanjayhire | last post by:
Hi All, I have just joined the forum. I need your help..As it's very urgent... How to identify a particular process is running on a server(Windows/Unix server) using VB program and since how...
6
by: thijo | last post by:
public class Point { private int x; private int y; private int Number;
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
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...
0
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...
0
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...
0
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,...

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.