Difference between revisions of "TWSocket.Addr"

From Overbyte
Jump to navigation Jump to search
Line 20: Line 20:
  
 
== How to ==
 
== How to ==
 +
 +
* Listen on multiple interfaces
 +
 +
You may listen on one interface (giving his IP address) or all interfaces (giving 0.0.0.0 as IP address). To listen to several IP addresses but not all, you have to use a TWSocket for each interface you want to listen to. Just use the same event handler for all your TWSocket components and of course always use sender argument in all those event handlers.
 +
 +
Note that this counts for a UDP listener and that for a TCP server the use of [[TWSocketServer]] is preferable.

Revision as of 18:31, 20 February 2006

Main page -> ICS component reference -> TWSocket -> Addr

Definition

property Addr: string;

Description

Client

The host to connect to. It can be a dotted IP address or a hostname. If it is a dotted IP address then Connect will return immediatly, if it is a hostname it will block until the hostname is resolved, so DNSLookUp is perferable.

Server

The interface to listen on. 0.0.0.0 means all interfaces. Note that for a TCP server the use of TWSocketServer is preferable.

Example

Best practices

How to

  • Listen on multiple interfaces

You may listen on one interface (giving his IP address) or all interfaces (giving 0.0.0.0 as IP address). To listen to several IP addresses but not all, you have to use a TWSocket for each interface you want to listen to. Just use the same event handler for all your TWSocket components and of course always use sender argument in all those event handlers.

Note that this counts for a UDP listener and that for a TCP server the use of TWSocketServer is preferable.