Difference between revisions of "TWSocket.Addr"
Jump to navigation
Jump to search
(→Server) |
(→Client) |
||
Line 9: | Line 9: | ||
=== Client === | === Client === | ||
− | The host to connect to. It can be a dotted IP address or a hostname. If it is a dotted IP address then | + | The host to connect to. It can be a dotted IP address or a hostname. If it is a dotted IP address then [[TWSocket.Connect | Connect]] will return immediatly, if it is a hostname it will block until the hostname is resolved, so [[TWSocket.DNSLookup | DNSLookup]] is perferable. |
=== Server === | === Server === |
Revision as of 17:56, 25 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.