How to use a specific LOCAL ip address endpoint??

A

Amil

I have code that creates a TcpClient socket. Right now, it just uses a
default IP address
and port for the local endpoint. If I want to use a specific IP address and
endpoint, do I
just perform a Bind(...) on the socket after I create it? Any examples out
there?

Amil
 
K

Kumar Gaurav Khanna [.NET MVP]

Hi!

Instead of TcpClient, you should consider using the Socket class and
explicitly Bind to the endpoint you wish to use. Otherwise, you will need to
derive a class from TcpClient and use the Client protected property and then
Bind using that Socket instance.
 
A

Amil

That sounds like a pretty good approach. But, I use some properties of the
TcpClient
like ReceiveTimeout, that don't seem to be available in the base Socket
class.

Amil
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top