|
Subject:
|
Derive TcpClient
|
|
Posted By:
|
simon.gysi@gmx.ch
|
Post Date:
|
10/7/2004 12:36:18 PM
|
Hi there
I try to have a specialized TcpClient. Therefore MyTcpClient derives from TcpClient. Now, i thougt the following is possible:
MyTcpClient client = (MyTcpClient) listener.AcceptTcpClient();
But the cast fails. Any idea why or a way to go around the problem?
Thank and cheers Simon
Visit: www.fhzh.ch/~sgysi" target="_blank">http://pubwww.fhzh.ch/~sgysi
|
|
Reply By:
|
Ankur_Verma
|
Reply Date:
|
10/8/2004 5:54:01 AM
|
What error do you get, syntax-wise your code is correct.
|
|
Reply By:
|
simon.gysi@gmx.ch
|
Reply Date:
|
10/8/2004 11:02:07 AM
|
Hi
Compiles, but throws a invalid vast exception.
Simon
|
|
Reply By:
|
Ankur_Verma
|
Reply Date:
|
10/10/2004 12:59:58 AM
|
I tried it and found the same problem, although you can use classes derived from TcpClient on the client side.
|
|
Reply By:
|
Kep
|
Reply Date:
|
10/11/2004 6:18:18 PM
|
The only way you can get this to work is to use AcceptSocket().
try...
MyTcpClient client = new MyTcpClient(listener.AcceptSocket());
This should do what you need.
Kep.
|
|
Reply By:
|
simon.gysi@gmx.ch
|
Reply Date:
|
10/11/2004 11:01:18 PM
|
Thank all! Simon
|