How to use a specific LOCAL ip address endpoint??

  • Thread starter Thread starter Amil
  • Start date Start date
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
 
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.
 
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
 
Back
Top