TBlockSocket.Connect
TBlockSocket
procedure Connect(IP, Port: string); virtual;
Unit
blcksock
Description
Connects socket to remote IP address and PORT. The same rules as with BIND method are valid. The only exception is that PORT with 0 value will not be connected.
If you use stream type of socket (like TCP), after call to this method a communication channel between local and remote socket is created. Local socket is assigned automatically if not controlled by previous call to BIND method.
On datagram type (like UDP) is only seting filters for datagrams. Only datagrams incoming from remote IP and port is passed to your application and you may it read by RecvBuffer function and send datagrams to this remote side by SendBuffer function.
Structures LocalSin and RemoteSin will be filled with valid values.
When you call this on non-created socket, then socket is created automaticly. Type of created socket is by Family property. If is used SF_IP4, then is created socket for IPv4. If is used SF_IP6, then is created socket for IPv6.
When you have family on SF_Any (default!), then type of created socket is determined by address resolving of destination address. (Not work properly on prilimitary winsock IPv6 support!)
See also:
Bind, IP6used, LocalSin, PreferIP4, RecvBuffer, RemoteSin, SendBuffer