Mark- 31 Posted 7 hours ago Hello, The Wiki page https://wiki.overbyte.eu/wiki/index.php/TWSocket Addr Client: The host to connect to. Server: The interface to listen on. LocalAddr The local address to which the socket is bound. Is this true for TCP and UDP? For a client, Addr is the remote (host) address and LocalAddr, if specified, is the interface to bind the socket. For a server, Addr specifies the interface to listen on so LocalAddr is not used. Mark Share this post Link to post
Angus Robertson 634 Posted 7 hours ago For UDP server, TWSocket Addr and Port are set for listening. For UDP client, TWSocket LocalAddr and LocalPort may be set but are usually left blank, the remote address and port are specified in the SendTo method when sending data. Angus Share this post Link to post
Mark- 31 Posted 7 hours ago 4 minutes ago, Angus Robertson said: For UDP server, TWSocket Addr and Port are set for listening. For UDP client, TWSocket LocalAddr and LocalPort may be set but are usually left blank, the remote address and port are specified in the SendTo method when sending data. Angus Thanks for the response. So, for a UDP server, setting the addr is the interface address and LocalAddr is ignored? For a UDP client, how to bind the socket to an interface device? Using LocalAddr? Mark Share this post Link to post
Angus Robertson 634 Posted 5 hours ago In what way was my response unclear? Angus Share this post Link to post
Mark- 31 Posted 5 hours ago 1 minute ago, Angus Robertson said: In what way was my response unclear? Angus Using UDP, how to bind the socket to a NIC or other interface device? > For UDP client, TWSocket LocalAddr and LocalPort may be set but are usually left blank,... Does that bind the socket (UDP) to the NIC or whatever the interface device type? I am trying to make sure I understand, for what I am trying to accomplish, and I want to update the Wiki with more data. Share this post Link to post
Angus Robertson 634 Posted 4 hours ago For TCP and UDP client, setting LocalAddr attempts to bind to that address, if it exists. But it's generally a bad idea for clients to set LocalAddr, since IP addresses can be dynamic and change, interfaces can also come and go while your application is running. ICS has a component IcsIpChanges that reports such changes so servers in particular can know the IP address they are using has disappeared. BTW, please do not repeat everything I write, this is a threaded forum, so long quotes simply wastes space. Angus Share this post Link to post
Mark- 31 Posted 4 hours ago Thanks. Industrial application, lots of networks, binding is necessary in some instances. Share this post Link to post