473,395 Members | 1,343 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,395 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.
Sep 19 '05 #1
2 1303
I get ur point.
Actually tcplistner.AcceptTcpClient() return TcpClient object rather than ur
derived class object.
I assume even as operator wont work for u
try using AcceptSocket() method.

"Tom Rahav" <to******@nospam.nospam> wrote in message
news:Ok**************@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.

Sep 20 '05 #2
or use reflection :)

"Tom Rahav" <to******@nospam.nospam> wrote in message
news:Ok**************@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.

Sep 20 '05 #3

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

Similar topics

1
by: Aliandro | last post by:
Hi I am really stuck and need some expertise help please. I have an XML file: <XML> <USER_INFO> <USERNAME>username</USERNAME> <PASSWORD>password%</PASSWORD> </USER_INFO> <SITE_INFO>...
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: Srinivasa Parupalli | last post by:
Dear Friends, I am struck up with logic. I am using one class(BMSLexer) which takes filename as arugument and the instance of the class is used my another class. example is shown below. Now my...
4
by: Pete H | last post by:
I would like to have my new C++ projects start out with two configurations, UnicodeDebug and UnicodeRelease, instead of the standard Debug and Release configurations that Visual Studio always...
8
by: Chris | last post by:
Hi, All my websites and webservices are down. I get the following message Server Error in '/mywebservices' Application....
0
by: Miguel Dias Moura | last post by:
Hello, I am working on an Asp.Net 2.0 / SQL 2005 web site. I am using profile to save the users info on the database. For example, I have the following structure: Public Structure Name...
0
by: bprasanth_20 | last post by:
Hi, I need an urgent help. I need to create a UDF (User Defined Function) in DB2 SQL which can accept any number of arguments (from 2 to 5 arguments). I do not how to achieve this. When I pass 2...
7
by: prateekbtbl | last post by:
Hi Friends, I am new in PHP/MySQL, i am developing article managemenst system for my assignment. Where in the members of the site after registering under different packages will allow to view...
3
by: chetu | last post by:
I am getting the above msg. when I click my form, it was running fine yesterday, but not sure what happened. Can any one help?
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...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
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...
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...
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
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...

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.