Alex Rivera | Logout

Is it possible to convert between Socket and TcpClient objects?

Asked 2008-10-14T22:49:45.470
13

Here's another C#/.NET question based merely on curiousity more than an immediate need ...

If you had a Socket instance and you wanted to wrap it in the higher-level TcpClient class, is that possible and how would you do it?

Conversely if you have an instance of TcpClient, is it possible to get the underlying Socket?

Edit
Report

1 Answer

3

From TcpClient to Socket is very easy. tcpClientInstance.Client is the underlying Socket instance.

answered 2008-10-14T22:56:18.563

Your Answer