How
to Create an Explicitly Bound Socket
This topic describes how create an explicitly bound socket. 
Start the network interface connection with RConnection::Start() to
create an explicitly bound socket. 
 Creating an explicitly bound
socket
  Explicitly bound sockets can be created in two ways: 
 - Open a socket and bind the socket to a network interface connection.
 
- Open a socket and bind the socket to an IP address of the network
interface connection.
 
-   Call RSocket::Bind() and bind the socket to  an
IP address of the network interface connection.  -   RSocket::Bind() binds
the socket to a unique  IP address of the network interface connection.  -  
The following example code shows how to open a socket and bind  the socket
to a unique IP address of the WiFi connection.  - // open an implicit socket
TInt err = iRecvSock.Open( iSs, KAfInet, KSockDatagram, KProtocolInetUdp); 
User::LeaveIfError( err );
// This IP address maps to WiFi in the ced.cfg file
_LIT(KRasAddr,"192.168.220.4");
const TInt KPort = 7000;
TInetAddr addr;
err = addr.Input( KRasAddr ); 
User::LeaveIfError( err );
addr.SetPort( KPort );
// Now the socket is explicitly bound to WiFi  
err = iRecvSock.Bind( addr ); 
RDebug::Print( _L("testapp: ETH Bind() = %d"), err ); 
User::LeaveIfError( err );
  The following code block shows an extract from the ced.cfg file.
  ## 
[LANService]
ADD_SECTION
# COMMDB_ID = 1
Name=Ethernet
IfNetworks=ip
IpNetMask=255.0.0.0
IpGateway=0.0.0.0
IpAddrFromServer=FALSE
IpAddr=192.168.1.1
IpDNSAddrFromServer=FALSE
ConfigDaemonManagerName=NetCfgExtnDhcp
ConfigDaemonName=!DhcpServ
FIELD_COUNT=9
END_ADD
ADD_SECTION
# COMMDB_ID = 2
Name=Ethernet WiFi
IfNetworks=ip
IpNetMask=255.0.0.0
IpGateway=0.0.0.0
IpAddrFromServer=FALSE
-// This IP address maps to WiFi
IpAddr=192.168.220.4
IpDNSAddrFromServer=FALSE
IpNameServer1=194.72.6.51
IpNameServer2=194.72.6.52
ConfigDaemonManagerName=NetCfgExtnDhcp
ConfigDaemonName=!DhcpServ
LanServiceExtensionTableName=WLANServiceExtensionTable
LanServiceExtensionTableRecordId=4
FIELD_COUNT=13
END_ADD
 
The socket is explicitly bound to the specific IP address of the
network interface connection. 
 Explicit binding example
 Client A creates a socket
with explicit binding using the specified interface connection. 
 sock1 = RSocket.Open(srv,conn);
 ESock
creates the socket within the default connection and subconnection. 
 
 A socket can also be opened over a sub-connection using RSubConnection.
When the socket is opened, a new Service Access Point (SAP) is created for
the socket in ESock. The SAP is used to handle inbound
and outbound data.